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 #

removeListener(eventName, callback);

ArgumentTypeDescription
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');
}