Events and EventEmitter
Node.js uses an event-driven architecture. The events
module lets you create and handle custom events using the EventEmitter
class.
emitter.on(event, callback)
– Listens for an eventemitter.emit(event)
– Triggers the event- Used heavily in streams, servers, and async programming