Skip to content

Instantly share code, notes, and snippets.

Created Feb 25, 2017
What would you like to do?
//grab the Event Emitter from the events module
var Emitter = require('events');
//create our own instance of an Emitter
var emtr = new Emitter();
//create a new event and response on our listener
emtr.on('greet', function() {
console.log('A greeting occurred!');
//emit an event manually
//emtr, which was listening to a 'greet' event responds with
// 'A greeting occurred!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment