Performing Asynchronous Tasks Before Initializing getChartContext
With the ts-chart-sdk
, you can now perform any number of asynchronous tasks before calling getChartContext
. After calling getChartContext
, the SDK waits 30 seconds for each postMessage API and 60 seconds in total for the chart to render.
If your chart requires a specific context from ThoughtSpot before rendering, you can perform any necessary async processes before initialization.
Example
// Import the chart rendering library
import { getChartContext } from "ts-chart-sdk";
// Perform async operations before initialization
const resBeforeInitialize = await asyncFunctionBeforeInitialization(param);
(async () => {
const ctx = await getChartContext({
// Initialize params with resBeforeInitialize
});
})();
This functionality is enabled by ChartToTSEvent.InitStart
. ThoughtSpot registers this event before initializing the SDK context. Once the event is registered, the initialization process begins.
For more details, refer to ChartToTSEvent Documentation.