EventEmitter
EventEmitter is a class in Node.js' events module that provides a lightweight publish/subscribe pattern for event-driven programming. It enables objects to emit named events and allows other code to register listeners that respond when those events occur. This pattern is foundational to many Node.js core modules and user-defined components.
The core API centers on methods for managing listeners and emitting events. The on or addListener methods
Behavior and usage patterns: listeners are invoked in the order they were added. If a listener throws
Subclassing and usage: developers often subclass EventEmitter to create custom components that expose an event-based API.