Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created January 2, 2013 12:07
Show Gist options
  • Save takaheraw/4434125 to your computer and use it in GitHub Desktop.
Save takaheraw/4434125 to your computer and use it in GitHub Desktop.
var events = require('events');
var util = require('util');
function AsyncEmitter(){
var self = this;
process.nextTick(function(){
self.emit('bar');
});
}
util.inherits(AsyncEmitter, events.EventEmitter);
var foo = new AsyncEmitter();
foo.on('bar', function(){
console.log('bar event emitted');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment