> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedatabrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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:

```js theme={"dark"}
window.databrainServerEvent = (code: string) => {
  if (code) {
    // do something
  }
}
```

To implement it in dbn-dashboard component:

```html theme={"dark"}
<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

* ENTER\_FULL\_SCREEN\_MODE

* EXIT\_FULL\_SCREEN\_MODE

* ENTER\_SCHEDULED\_REPORT\_MODE

* SAVE\_SCHEDULED\_REPORT

* EXIT\_SCHEDULED\_REPORT\_MODE

* ENTER\_CUSTOMIZE\_LAYOUT\_MODE

* EXIT\_CUSTOMIZE\_LAYOUT\_MODE

* SAVE\_LAYOUT

* ENTER\_MANAGE\_METRICS\_MODE

* ENTER\_METRICS\_GALLERY\_MODE

* EXIT\_MANAGE\_METRICS\_MODE

* EXIT\_METRICS\_GALLERY\_MODE

* SAVE\_MANAGE\_METRICS

* SAVE\_CLIENT\_GALLERY\_METRICS

* ARCHIVE\_METRIC

* DOWNLOAD\_METRIC

* DOWNLOAD\_METRIC\_WITHOUT\_FILTERS

* SAVE\_METRIC\_PNG

* METRIC\_FILTER\_APPLIED

* DASHBOARD\_FILTER\_APPLIED

* CREATE\_METRIC

* UPDATE\_METRIC

* ENTER\_CREATE\_METRIC

* ENTER\_EDIT\_METRIC

* DATASET\_SEARCH\_FOCUSED

* DATASET\_TABLE\_SELECTED

* COLUMN\_DRAGGED\_TO\_DIMENSIONS

* COLUMN\_DRAGGED\_TO\_MEASURES

* COLUMN\_AGGREGATE\_CHANGED

* CHART\_TYPE\_CHANGED

* START\_DOWNLOAD\_ALL\_METRICS

* DOWNLOAD\_ALL\_METRICS

* START\_DASHBOARD\_PDF

* EXPORT\_DASHBOARD\_PDF

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