JSFiddle - React, Tailwind, and code Playground
by Glutamat
JavaScript
(function () {
//Somewhere before any script executes
var _call = Function.prototype.call,
_apply = Function.prototype.apply;
function apply (fn, thisArg) {
if ("function" === typeof fn) {
fn.apply = _apply;
fn.apply (thisArg,arguments);
delete fn.apply;
}
}
function call (fn,thisArg) {
if ("function" === typeof fn) {
fn.call = _call;
fn.apply (thisArg, arguments);
delete fn.call;
}
}
function foo () {console.log (this);}
function bar () {console.log (this);}
call (foo, {bar:"foo"});
setTimeout (function () {
bar.call ({foo:"bar"});
},0);
})();
var _call = Function.prototype.call;
Function.prototype.call = function call () {
if (arguments.length > 0 && "toString" !== this.name) {
console.log (this.name," called with arguments, ", arguments);
}
return _call.apply (this,arguments);
};