Saturday 27 May 2017

Node JS Event emitter not working if we first emit and then we listen

var events=require('events').EventEmitter;
var eventEmitter = new events();


eventEmitter.on('hello', function()
{ 
  console.log('Hey !!');
});

eventEmitter.emit('hello');

now if i first emit and then listen it will not print console.Help me to find the reason.



via john33

No comments:

Post a Comment