Capture rejections (not implemented)
Emit 'newListener' and 'removeListener' events
Alias for emitter.on(eventName, listener).
The instance this method was called on, useful for chaining
Alias for emitter.removeListener().
The instance this method was called on, useful for chaining
Adds the listener function to the end of the listeners array for the event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
The instance this method was called on, useful for chaining
Adds a one-time listener function for the event. The next time eventName is triggered, this listener is removed and then invoked.
The instance this method was called on, useful for chaining
Adds the listener function to the beginning of the listeners array for the event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
The instance this method was called on, useful for chaining
Adds a one-time listener function for the event to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.
The instance this method was called on, useful for chaining
Returns a copy of the array of listeners for the event, including any wrappers (such as those created by .once()).
The name of the event
Copy of the array of listeners for the event
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module.
Optional
event: keyof AllEventsThe instance this method was called on, useful for chaining
Removes the specified listener from the listener array for the event.
removeListener() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener() must be called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them from emit() in progress. Subsequent events behave as expected.
The instance this method was called on, useful for chaining
Noop, kept for compatibility.
The maximum number of listeners
The instance this method was called on, useful for chaining
EventEmitter
Description
Portable implementation of the Node.js EventEmitter class
See
https://nodejs.org/docs/latest/api/events.html#events_class_eventemitter