Open this example in the interactive library
Source code
import { EventEmitter, once, getEventListeners } from "node:events";
const bus = new EventEmitter();
console.log(bus.on("change", () => {}).listenerCount("change"));
Sample output
1

Open this example in the interactive library
import { EventEmitter, once, getEventListeners } from "node:events";
const bus = new EventEmitter();
console.log(bus.on("change", () => {}).listenerCount("change"));
1