An event name can exist without listeners at the point of inspection. Listener checks are snapshots of registration state.
Worked example
import { EventEmitter, once, getEventListeners } from "node:events";
const bus = new EventEmitter();
console.log(bus.emit("unknown"));Result
falseImplementation notes
A listener may be attached or removed later. Use the count for immediate diagnostics rather than as a durable guarantee that an event will be handled.
Try it yourself
Register one listener, remove it, and repeat the check.
Open the Node.js example →Editorial date September 16, 2026 · Published December 6, 2026