Better way to know when app is ready


#1

To know if an application is completely loaded I’m subscribing to each visualization promise (from the execute), so when the data is ready in that visualization I mark it as “ready”, when each visualization is marked then I can say that my dashboard is ready.

Then I realized that when I apply filters I have to use a different method. I looked into the documentation and I found the viz-finished event, so I could do something similar. But at the end I have two different pieces of code to check the same thing.

I wonder, is there a better/easier way to do that?


#2

The ChartFactor core object (cf) has a method called isAppLoaded() that for the current Toolkit version it returns true if all the visualizations registered under that object (those obtained with cf.getAllVisualizations()) are ready.

For the next version cf.isAppLoaded() will return a promise instead that will be resolved when all the visualizations are loaded. The reason is to avoid the need of an interval to query this method until the app is loaded.


#3

By the way, by “ready” I mean data ready, not render ready. We have plan to extend it to provide an approximate of when the visualization is rendered, so it can be more accurate.