Answers for "event emmiter in node js stackoverflow"

0

event emmiter in node js stackoverflow

const events = require('events'); 

const eventEmitter = new events.EventEmitter();

eventEmitter.on('scream', function() {
    console.log("Screaming");
});

eventEmitter.on('scream', function(name) {
    console.log(name+" is screaming");
});

eventEmitter.emit('scream', 'Bob');
Posted by: Guest on May-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language