Created
April 25, 2012 06:07
-
-
Save mikepack/2487006 to your computer and use it in GitHub Desktop.
Decorators in JS
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
function SomeClass() {} | |
SomeClass.prototype.do_it = function() { alert('doin it!'); } | |
s = new SomeClass(); | |
function Decorator(klass) { this.__proto__ = klass.__proto__; } | |
d = new Decorator(s) | |
d.do_it() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment