Created
April 26, 2012 23:05
-
-
Save westoque/2503983 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
var events = require('events'); | |
function Dog() { | |
} | |
util.inherits(Dog, events.EventEmitter); | |
// This statement will override the current `prototype`, thus losing | |
// the methods from EventEmitter. | |
Dog.prototype = { | |
fetch: function() { | |
} | |
} | |
// This one will work though | |
Dog.prototype.fetch = function() { | |
} | |
// Question is, if my `Dog.prototype = {}` has lots of methods. I don't | |
// want to rewrite all of them to be like `Dog.prototype.METHOD_NAME`.. | |
// how do I get around this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment