Created
October 5, 2012 19:20
-
-
Save isao/3841808 to your computer and use it in GitHub Desktop.
extend eventemitter w/ Object.create and mixin
This file contains hidden or 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 Event = require('events').EventEmitter; | |
function Person(name) { | |
this.name = name | |
} | |
function getname() { | |
return this.name | |
} | |
Person.prototype = Object.create(Event.prototype, { | |
getname: { | |
value: getname | |
} | |
}); | |
Author
isao
commented
Oct 5, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment