Skip to main content

listeners

method EventEmitter.listeners
Jump to headingEventEmitter.listeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>

Returns a copy of the array of listeners for the event named eventName.

server.on('connection', (stream) => {
  console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]

Type Parameters Jump to heading

Parameters Jump to heading

Jump to headingeventName: Key<K, T>

Return Type Jump to heading

Array<Listener2<K, T>>
Back to top