Event capturing namespace

£可爱£侵袭症+ 提交于 2019-12-24 06:47:35

问题


Somewhere in my app I have a Tabs component and some tabs use a specific component which must use event capturing on the window (because D3...), anyway, the question is how to namespcae these specific events so I could run a "cleanup" just for them when switching between tabs (because window is shared between them).

For example: (should only be fired on its own tab)

window.addEventListener("mouseup", function(e){
    console.log(1); // simplified code obviously
});

I cannot simply remove all the mouseup event listeners in my cleanup method because who knows what else relies on this event somewhere else. Just want to clean specific ones. with jQuery namespacing events is easy, but jQuery doesn't support event capturing.

来源:https://stackoverflow.com/questions/38572501/event-capturing-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!