Created
July 8, 2018 03:10
-
-
Save wizard04wsu/aa2537367ad13e20f6c8fb24b6998806 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
function bind(targetFunction, thisArg){ | |
"use strict"; | |
var boundArgs = Array.prototype.slice.call(arguments, 2); | |
try{ | |
return Function.prototype.bind.apply(targetFunction, [thisArg].concat(boundArgs)); | |
}catch(e){ | |
function boundFunction(){ | |
return targetFunction.apply(thisArg, boundArgs.concat(arguments)); | |
} | |
boundFunction.toString = function toString(){ return targetFunction.toString(); }; | |
Object.defineProperties(boundFunction, { 'toString':{ enumerable:false } }); | |
return boundFunction; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment