method EventEmitter.prependListener
Jump to headingEventEmitter.prependListener<K>(): this
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.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter
, so that calls can be chained.
Type Parameters Jump to heading
Parameters Jump to heading
Jump to headingeventName: Key<K, T>
The name of the event.
Jump to headinglistener: Listener1<K, T>
The callback function
Return Type Jump to heading
this