Skip to content

Instantly share code, notes, and snippets.

@SomeoneWeird
Forked from anonymous/gist:4443836
Last active December 10, 2015 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SomeoneWeird/4443857 to your computer and use it in GitHub Desktop.
Save SomeoneWeird/4443857 to your computer and use it in GitHub Desktop.
/* Consumer.js */
var Consumer = function() {};
Consumer.prototype.findById = function(id) {
this.emit('done', this);
};
util.inherits(Consumer, EventEmitter);
module.exports = Consumer;
/* index.js */
var consumer = new Consumer();
consumer.on('done', function(result) {
console.log(result);
});
consumer.findById("50ac3d1281abba5454000001");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment