Node.js module
events
The 'node:events' module provides the EventEmitter class, which is the foundation for handling event-driven programming in Node.js. Objects inheriting from EventEmitter can emit named events and have listeners subscribe to those events.
It supports adding and removing listeners, once-only listeners, event forwarding, and wildcard events, serving as the backbone for core modules like http.Server and many application frameworks.
Fully supported in Bun
Fully implemented. 100% of Node.js's test suite passes. EventEmitterAsyncResource uses AsyncResource underneath.
Classes 1
- class events.default
The
EventEmitterclass is defined and exposed by thenode:eventsmodule.