removeListener #
Removes a listener function from an event.
Arguments #
removeListener(eventName, callback);
Argument | Type | Description |
---|---|---|
eventName | string | The name of the event |
callback | function | Callback to remove |
Return #
The KuzzleEventEmitter
instance.
Usage #
const eventEmitter = new KuzzleEventEmitter();
const listener = () => console.log('disconnected');
eventEmitter
.addListener('disconnected', () => console.log('disconnected'))
.addListener('disconnected', listener);
eventEmitter.removeListener('disconnected', listener);
if (eventEmitter.listeners('disconnected').length === 1) {
console.log('Successfully removed the listener');
}
Edit this page on Github(opens new window)