Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:07:08+00:00 2026-05-27T06:07:08+00:00

I am working on a JavaScript framework – front-end for Cubes for the Slicer

  • 0

I am working on a JavaScript framework – front-end for Cubes for the Slicer OLAP server. I am now about to implement aggregation browser object, which will perform queries to the server. Proposed API example:

  • browser.aggregate(cell, {drilldown:some_dimension}) – get aggregation of a cell and drill-down through a dimension
  • browser.facts(cell) – get all facts within a cell
  • …

I am thinking about three options of handling the result:

A: in each browser call:

browser.aggregate(cell, options, handler)

or B: in the browser for any query:

browser.result_handler = my_result_handler
browser.aggregate(cell, options)

Where the result handler would be something like:

result_handler = function(browser, result, context) { ... }

or C: delegate object:

browser.delegate = my_controller

Where the my_controller would have methods that will correspond to the browser query methods.

or is there any another option D?

I am very new to JavaScript (in fact, this is my first thing written in the language). What is the most common way of doing this kind of async handling in JS frameworks? I am more inclined to the common handler in the browser, option B.

The framework I am creating is here: https://github.com/Stiivi/cubes.js (using underscore.js and jQuery)

I have a working example if someone is interested, I am not putting it here, as it is not very polished, just sand-box/playground kind of thing.

I would be very grateful for any constructive tips.

[EDIT] Note that the browser object is not one-time disposable object for one query, it is reused frequently for each part of a report in a web application. It is used, as name suggests, for browsing the data. Want a chart? Use browser for aggregation. Want a table? Use browser. Want to drill-down/get more details? Use the same browser. “Cell” object holds current browsing context, it is like multi-dimensional “current directory” if compared to single-dimensional file system.

[EDIR 2] Example of usage: you have a page with a bar chart, aggregated by year, and a pie chart with table aggregated by a category. The pie+table contains same data. You will need two requests for two contexts: bar and pie:

browser.aggregate(cell, { context: "bar" }, handler)
browser.aggregate(cell, { context: "pie" }, handler)

or when handler is in the browser:

browser.aggregate(cell, { context: "bar" })
browser.aggregate(cell, { context: "pie" })

handler in the browser removes some code noise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:07:08+00:00Added an answer on May 27, 2026 at 6:07 am

    Note that the browser object is not one-time disposable object for one query

    I think you’ve answered your own question.

    aggregate makes a network request (it does, right?) and you don’t know how long could that take. If you had one callback for request, and you made another request before the previous one was finished, the previous callback function would be never called.

    If you’re asking what’s the common pattern, I’d say definitely passing a callback.

    For example, on client side, jQuery does it for networking. On server side (Node.js), there’s HTTP request/server, they pass callbacks, then there’s Socket.IO or Websocket, both pass callbacks. Then there are databases, Mongo, Redis, they all pass callbacks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a sophisticated JavaScript library for working with my company's server side framework.
I'm working on a very lightweight system to test a javascript framework I am
I am working on a web application project using Tapestry 5 framework/javascript. This application
I'm working through this build-a-JavaScript-framework tutorial . Why in the following code is $super
I am working on a javascript framework. I have several independent scripts that look
I'm working without the JavaScript framework, but I want to call a function just
I'm creating a javascript framework, and the code below is not working for some
I dont work with a framework, i'm working with JavaScript by default. I need
I'm working on developing a javascript framework and I don't want anyone to be
Hi Can somebody fill me in on JavaScript Testing Frameworks? I'm working on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.