Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4443836 to your computer and use it in GitHub Desktop.
Save anonymous/4443836 to your computer and use it in GitHub Desktop.
/* Consumer.js */
var Consumer = function() {};
Consumer.prototype = {
findById: function(id) {
... some code ...
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);
}).findById("50ac3d1281abba5454000001");
/* ERROR CODE */
{"code":"InternalError","message":"Object [object Object] has no method 'findById'"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment