Created
March 13, 2014 21:16
-
-
Save ryanflorence/9537139 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 Foo, | |
__hasProp = {}.hasOwnProperty, | |
var __extends = function(child, parent) { | |
// direct property injection of parent constructor Function | |
for (var key in parent) { | |
if (__hasProp.call(parent, key)) | |
child[key] = parent[key]; | |
} | |
// new "wrapper" constructor function | |
function ctor() { | |
// make so ctor thinks its `instanceof child` event thought its a ctor | |
this.constructor = child; | |
} | |
// inherit the prototype methods to the wrapper | |
ctor.prototype = parent.prototype; | |
// set the prototype to a new instance of ctor | |
child.prototype = new ctor(); | |
// allow calling super | |
child.__super__ = parent.prototype; | |
// return | |
return child; | |
}; | |
Foo = (function(_super) { | |
__extends(Foo, _super); | |
function Foo() { | |
return Foo.__super__.constructor.apply(this, arguments); | |
} | |
return Foo; | |
})(Bar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment