5 Program to demonstrate Event Emitter in NodeJS

Program:

var events = require('events');



var emitter = new events.EventEmitter();



emitter.on('publishVideo', function(message){

    console.log(message);

});



emitter.emit('publishVideo',"CodingAtharva has uploaded a new Video");


Output:

Event Emitter in NodeJS

Previous
Next Post »