EventEmitter
The Node.js class for objects that emit named events and call registered listener functions, similar to the browser's EventTarget.
In more detail
It uses emit and on instead of dispatchEvent and addEventListener. In the browser, EventTarget fills the same role natively.
Related terms
- EventTarget — The built-in browser interface for anything that can receive events, providing addEventListener, removeEventListener and dispatchEvent.
- events.once() — A Node.js helper that returns a promise which resolves the next time an EventEmitter emits the named event.
- stream — Data that flows between a program and a source or destination piece by piece, rather than all at once.
- callback — A function you pass to other code so it can call you back later, for example when an event happens or a timer fires.
Taught in
- CustomEvent Dispatching And Decoupled Component Event Buses — Frontend Architecture & Web Platform
- Close Phase & Signal Dispatch: Sockets & Teardown — Node.js Internals & Backend Services
- Stream Mechanics: Readable Streams & Flowing Modes — Node.js Internals & Backend Services
- Writable Streams: Drain Events & highWaterMark — Node.js Internals & Backend Services