Created
January 3, 2013 14:24
-
-
Save anonymous/4443836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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