在不影响事件绑定事件和不影响第三方插件的业务逻辑情况下,跟踪绑定事件的内容,解决内存泄漏问题

;(window => {
const _cathe = window.addEventListener;
window.addList = [];
const handler = {
apply:function(target,thisbinding,args){
Reflect.apply(_cathe,window,args)
window.addList.push(args[0])
console.log(thisbinding)
target()
}
}
window.addEventListener = new Proxy(() => {
console.log(window.addList);
},handler)
})(window)

全部评论

相关推荐

自来熟的放鸽子能手面...:这个不一定,找hr跟进一下
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务