MediaWiki:LAPI.js: Difference between revisions
Content deleted Content added
mNo edit summary |
Fix Function.prototype.bind polyfill - https://phabricator.wikimedia.org/T70235#1096456 |
||
Line 190:
/** Function enhancements ************/
// Return a function that calls the function with 'this' bound to 'thisObject'
▲if (!Function.prototype.bind) { // JS 1.8.5 has bind()
Function.prototype.bind = function (thisObject) {
var f = this, obj = thisObject, slice = Array.prototype.slice, prefixedArgs = slice.call (arguments, 1);
return function () { return f.apply (obj, prefixedArgs.concat (slice.call (arguments))); };
};
}
|