SDK
SDK Javascript v6.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

removeListener #

Removes a listener function from an event.

Arguments #

Copied to clipboard!
removeListener(eventName, callback);

Argument Type Description
eventName
string
The name of the event
callback
function
Callback to remove

Return #

The KuzzleEventEmitter instance.

Usage #

Copied to clipboard!
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');
}