🈂ī¸Server Event

It is a function prop that detects and retrieves error or loading occurring within dashboard component, facilitating timely resolution and enabling various automated tasks to be triggered in response.

To make use of 'handle-server-event ' in dbn-dashboard, you first need to define the function that you want to pass to this prop in the global object, here's an example:

window.databrainServerEvent = (code: string) => {
  if (code) {
    // do something
  }
}

To implement it in dbn-dashboard component:

<dbn-dashboard handle-server-event="databrainServerEvent" />

This will attatch the funtion to the dbn-dashboard component, fetching the error or loading status which you can handle in your app.

Below is the list of all the codes that you can get from dbn-dashboard:

  • TOKEN_EXPIRED

  • UNAUTHORIZED_ORIGIN

  • INVALID_TOKEN

  • INVALID_DASHBOARD_ID

  • IS_LOADING

  • DATA_LOADED

NOTE: If you get error like Property 'functionName' does not exist on type 'Window & typeof globalThis', add the type of window as any.

Last updated