# on method

Information note**STABLE.**   
  
This API is reliable and breaking changes are unlikely.

global.on(eventName, callback)

Adds listeners for the global events. Multiple listeners can be added to an event.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | Qlik Sense February 2018 |

## Parameters

### eventName

Type: String

Name of the event. Can be:

* error
* warning
* closed

### callback

Type: Function

Optional.

Callback method. Registers a callback that is executed every time data is returned.

## Example

```
var global = qlik.getGlobal(config);
global.on("error", function ( error ) {
  console.log("error listener called for global", error);
} );
global.on("warning", function ( warning ) {
  console.log("warning listener called for global", warning);
} );
global.on("closed", function ( closed ) {
  console.log("closed listener called for global", closed);
} );
```