Interface InitApi

An API to manage the asynchronous initialization of solution applications before the Visual Investigator application is fully initialized.

Accessed from the window at window.sas.viInit

window.sas.viInit.registerResourceBundle(bundleName, resources);
interface InitApi {
    declareApp(appName: string, i18nResourceBundleName?: string): void;
    notifyAppReady(appName: string): void;
    registerResourceBundle(bundleName: string, resources: I18nResources): void;
    whenAppReady(name: string, timeout?: number): Promise<void>;
}

Methods

  • Declare an application. Visual Investigator will await whenReady for each before continuing its own app initialization. notifyAppReady should be called to indicate when the app initialization is complete. if provided, registerResourceBundle should be called to indicate when the I18n resource bundle is ready.

    Parameters

    • appName: string

      appName of the app configuration.

    • Optionali18nResourceBundleName: string

      I18n resource bundle name of the app configuration.

    Returns void

  • Notify listeners that the app has been initialized.

    Parameters

    • appName: string

      appName of the app configuration.

    Returns void

  • Register a resource bundle with the Resource Service.

    Parameters

    • bundleName: string

      {string} Name for the bundle to be stored in the resource cache.

    • resources: I18nResources

      {I18nResources} Object containing the resources to be added for the bundle specified by the bundleName parameter.

    Returns void

  • Resolves once notifyAppReady has been called for the given app name, or once the given SviInitEvent is ready. Will reject with an error if timeout elapses before notifyAppReady is called.

    Parameters

    • name: string

      name of the app configuration or init event.

    • Optionaltimeout: number

      max wait (milliseconds) before the promise is rejected (defaults to APP_INIT_TIMEOUT_MS).

    Returns Promise<void>