Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/assets/js/easy-pie-chart/test/polyfills/bind.js
1293 views
1
// IE function.bind polyfill
2
if (!Function.prototype.bind) {
3
Function.prototype.bind = function (oThis) {
4
if (typeof this !== 'function') {
5
// closest thing possible to the ECMAScript 5 internal IsCallable function
6
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
7
}
8
9
var aArgs = Array.prototype.slice.call(arguments, 1),
10
fToBind = this,
11
fNOP = function () {},
12
fBound = function () {
13
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
14
aArgs.concat(Array.prototype.slice.call(arguments)));
15
};
16
17
fNOP.prototype = this.prototype;
18
fBound.prototype = new fNOP();
19
20
return fBound;
21
};
22
}
23
24