Package-level declarations
Types
The EventEmitter
class is defined and exposed by the node:events
module:
Integrates EventEmitter
with AsyncResource
for EventEmitter
s that require manual async tracking. Specifically, all events emitted by instances of events.EventEmitterAsyncResource
will run within its async context
.
Functions
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments to each.
Returns the number of listeners listening for the event named eventName
. If listener
is provided, it will return how many times the listener is found in the list of the listeners of the event.
Adds the listener
function to the end of the listeners array for the event named eventName
. 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.
Adds the listener
function to the beginning of the listeners array for the event named eventName
. 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.
Returns a copy of the array of listeners for the event named eventName
, including any wrappers (such as those created by .once()
).
Removes all listeners, or those of the specified eventName
.