问题描述
我想将 ES6 代理用于警报功能,当我在构建代理时使用变量引用它时,警报根本不起作用。
let referencetoAlert = alert;
referencetoAlert = new Proxy(referencetoAlert,{
apply: (target,thisArg,args) => {
console.log(thisArg)
console.log(args)
return "Alert called";
}
});
alert("Hello") // No effect (But it should)
referencetoAlert("Hello") // Has effect
如何用引用变量代替原始警报函数?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)