我尝试使用代理进行猴子补丁以在我的类中运行。
如何访问和调用原始函数?
class foo {
x = 10;
bar() {
console.log({ x: this.x });
}
}
foo.prototype.bar = new Proxy(foo.prototype.bar, {
apply: function() {
console.log("xxx");
console.log({ that: this });
this.bar();
}
});
new foo().bar();
慕田峪7331174
米琪卡哇伊
相关分类