((w) => {
w.listenerList = new Set();
const _cache = w.addEventListener;
const handler = {
apply: (target, thisbinding, args) => {
target();
listenerList.add(args[0]);
Reflect.apply(_cache, w, args)
}
}
w.addEventListener = new Proxy((evntname, fn) => {
// console.log(listenerList)
console.log(evntname)
}, handler)
})(window)
window.addEventListener("resize", function () {
console.log(1)
})
window.addEventListener("resize", function () {
console.log(2)
})
es6 函数代理 获取绑定过的事件委托
最新推荐文章于 2022-07-14 14:28:30 发布