Loading…

What do you mean by Event Emmitter?

EventEmitter class lies in the events module, and is accessibly through the following syntax:

//import events module
var events = require('events');
//create an eventEmitter object
var eventEmitter = new events.EventEmitter();

In case an EventEmitter instance is facing error, it emits 'error' event. When a new listener is added, the 'newListener' event gets fired and when a listener gets removed, 'removeListener' event gets fired.

Suggest An Answer

No suggestions avaliable!

Latest post from Node js Interview Questions

Ask Question