我的代码在这里:
var target = Array.prototype.push
var handler = {
apply: function () {
return 'I am the proxy';
}
};
var p = new Proxy(target, handler);
Array.prototype.push = p
console.log(p,p(1));
错误在这里:
[功能:推送]'我是代理'internal / process / next_tick.js:93 callback = tock.callback; ^
TypeError:无法读取未定义的属性'callback' at process._tickCallback(internal / process / next_tick.js:93:24)
当我将观察者函数分配给Array.protoType
时,我收到了此错误。问题出在哪儿?