Created
February 22, 2020 16:51
-
-
Save Farenheith/26dda8936ed446636fbba61e898fbd4e 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
import { EventEmitter } from 'events'; | |
export function eventEmitterExample(emitter: EventEmitter) { | |
emitter.on('somethingHappen', (x) => { | |
console.info(`Something happened! ${x}`); | |
}); | |
emitter.on('sometingGoesWrong', (x) => { | |
console.error(`Something went wrong! ${x}`); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment