1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| if (!Function.prototype.bind) (function(){ var slice = Array.prototype.slice.call.bind(Array.prototype.slice); Function.prototype.bind = function() { var thatFunc = this, thatArg = arguments[0]; var args = slice(arguments, 1); if (typeof thatFunc !== 'function') { throw new TypeError('Function.prototype.bind - ' + 'what is trying to be bound is not callable'); } return function(){ var funcArgs = args.concat(slice(arguments)) return thatFunc.apply(thatArg, funcArgs); }; }; })();
|