Skip to main content
EventEmitter.listeners - node__events.d.ts - Node documentation
method EventEmitter.listeners

Usage in Deno

```typescript import { type EventEmitter } from "node:node__events.d.ts"; ```
EventEmitter.listeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>
Returns a copy of the array of listeners for the event named `eventName`. ```js server.on('connection', (stream) => { console.log('someone connected!'); }); console.log(util.inspect(server.listeners('connection'))); // Prints: [ [Function] ] ```

Type Parameters

K

Parameters

eventName: Key<K, T>

Return Type

Array<Listener2<K, T>>