Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created January 2, 2013 12:21
Show Gist options
  • Save takaheraw/4434216 to your computer and use it in GitHub Desktop.
Save takaheraw/4434216 to your computer and use it in GitHub Desktop.
var events = require('events');
var util = require('util');
function AsyncCB(cb){
if(cb){
process.nextTick(function(){
cb();
});
}
}
util.inherits(AsyncCB, events.EventEmitter);
AsyncCB.prototype.setbaz = function(arg){
this.baz = arg;
};
var foo = new AsyncCB(function(){
foo.setbaz('bar');
console.log(foo.baz);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment