Skip to content
Snippets Groups Projects
Commit 5d170a67 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Adding Function.prototype.bind for browsers that do not support it.

parent 30bc113d
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ steal.plugins(
'crypto-api',
'channel',
'storage',
'browserid-extensions',
'browserid-network',
'browserid-errors',
'browserid-wait') // 3rd party script's (like jQueryUI), in resources folder
......
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") // closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable");
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment