Created
October 14, 2019 17:49
-
-
Save deepal/80cf69f6e7a217694ef5e34190f1fdfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {EventEmitter} = require('events'); | |
const emitter = new EventEmitter(); | |
emitter.on('message', (message) => { | |
console.log(`Handler 1 message: ${message}`); | |
}); | |
emitter.on('message', (message) => { | |
console.log(`Handler 2 message: ${message}`); | |
}); | |
emitter.on('message', (message) => { | |
console.log(`Handler 3 message: ${message}`); | |
}); | |
emitter.emit('message', 'hi there!'); | |
console.log('This runs in the last :|'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment