-
-
Save dpjayasekara/3ca125a8ed40b0fdab54f3f841dafecd 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