External: EventEmitter

client~EventEmitter

Methods

addListener(event, listener) → {EventEmitter}

Parameters:
Name Type Description
event string The event to listen for.
listener function The function to invoke.
Source:
Returns:
for call chaining.
Type
EventEmitter

emit(event, listener) → {boolean}

Execute each of the listeners in order with the supplied arguments.
Parameters:
Name Type Description
event string The event to emit.
listener function The function to invoke.
Source:
Returns:
true if event had listeners, false otherwise.
Type
boolean

on(event, listener) → {EventEmitter}

Adds a listener to the end of the listeners array for the specified event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added multiple times.
Parameters:
Name Type Description
event string The event to listen for.
listener function The function to invoke.
Source:
Returns:
for call chaining.
Type
EventEmitter

once(event, listener) → {EventEmitter}

Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.
Parameters:
Name Type Description
event string The event to listen for.
listener function The function to invoke.
Source:
Returns:
for call chaining.
Type
EventEmitter

removeAllListeners(event) → {EventEmitter}

Removes all listeners, or those of the specified event. It's not a good idea to remove listeners that were added elsewhere in the code, especially when it's on an emitter that you didn't create (e.g. sockets or file streams).
Parameters:
Name Type Description
event string Optional. The event to remove listeners for.
Source:
Returns:
for call chaining.
Type
EventEmitter

removeListener(event, listener) → {EventEmitter}

Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener.
Parameters:
Name Type Description
event string The event to listen for.
listener function The function to invoke.
Source:
Returns:
for call chaining.
Type
EventEmitter

setMaxListeners(n) → {EventEmitter}

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
Parameters:
Name Type Description
n Number The max number of listeners.
Source:
Returns:
for call chaining.
Type
EventEmitter