
I'm trying to overwrite the builtin Function.prototype.call function to log function calls for debugging. In the browser I would do something like
(function() {
var call = Function.prototype.call;
Function.prototype.call = function() {
log(this, arguments);
return call.apply(this, arguments);
};
}());
I seem to be missing something essential about the way the API works, since the above code basically works but it doesn't seem to have access to 'this' and 'arguments' variables? Has somebody tried something like that and can point me in the correct direction?