SDK
SDK Javascript v7.x
2

# addListener

Adds a listener function to the end of the listeners array for an event.
Whenever an event is triggered, listener functions are called in the order they were registered.

# Arguments

Copied to clipboard!
addListener (eventName, callback);

Argument Type Description
eventName
string
The name of the event
callback
function
Function to call every time the event is triggered

# Return

The KuzzleEventEmitter instance.

# Usage

Copied to clipboard!
const eventEmitter = new KuzzleEventEmitter();
eventEmitter.addListener('myEvent', () => console.log('Caught event "myEvent"!'));
// Prints: Caught event "myEvent"!
eventEmitter.emit('myEvent');