Created
March 18, 2011 17:07
-
-
Save getify/876439 to your computer and use it in GitHub Desktop.
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 function_sandbox = (function(global) { | |
| function SubFunc(func) { | |
| func.__proto__ = funcPlugin; | |
| return func; | |
| } | |
| var funcPlugin, __Function = global.Function; | |
| // make prototype values conform to ECMA spec and inherit from regular natives | |
| (SubFunc.prototype = new __Function('')).__proto__ = __Function.prototype; | |
| // assign constructor property | |
| (funcPlugin = SubFunc.prototype).constructor = SubFunc; | |
| return SubFunc; | |
| })(this); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: