What is EventEmitter in Node.js?

All objects that emit events are instances of the EventEmitter class. 

These objects expose an eventEmitter.on() function that allows one or more functions to be attached to named events emitted by the object.

When the EventEmitter object emits an event, all of the functions attached to that specific event are called synchronously.

Image for post

Comments

Popular posts from this blog

What is a Callback function in Node.js?

What is an Event loop in Node.js and how does it work?