问题
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