Javascript 7.x

listeners

Returns the listener functions bound to a specific event.

Arguments

Copied to clipboard!
listeners(eventName);

Return

An array of listener functions.

Usage

Copied to clipboard!
const eventEmitter = new KuzzleEventEmitter();
eventEmitter.addListener('myEvent', () => console.log('Hello'));
eventEmitter.addListener('myEvent', () => console.log('Hello World'));
const listeners = eventEmitter.listeners('myEvent');
console.log(`There are ${listeners.length} listeners bound to the event "myEvent"`);