在油猴脚本中打算 hook 一个 xhr 请求,写出如下代码
var x = unsafeWindow.$.ajax();
unsafeWindow.$.ajax = function(args) {
console.log(args);
return x.apply(unsafeWindow.$.ajax, args);
}
结果 Chrome 提示 apply is not a function... console.log 能正常执行,但是为什么最后一行不对呢?