Skip to content

Instantly share code, notes, and snippets.

@michaelavila
Created October 30, 2013 21:40
Show Gist options
  • Save michaelavila/7240820 to your computer and use it in GitHub Desktop.
Save michaelavila/7240820 to your computer and use it in GitHub Desktop.
var events = require('events')
var emitter = new events.EventEmitter();
emitter.addListener('hello', sayHello);
function doSomething() {
emitter.emit('hello');
console.log('This should run last');
}
function sayHello() {
console.log("Hello!");
}
doSomething();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment