Reputation: 2972
Is there a way to cancel/remove all event listeners from an element? I didn't set these listeners by myself so I don't have a StreamSubscription
I could use. I need to get them somehow.
So some library did this:
querySelector('body').onMouseUp.listen(handler);
And I want to remove that (and all other) handlers again.
Upvotes: 2
Views: 164
Reputation: 657871
You can add an onMouseUp
event handler in a child element and call stopPropagation
and/or stopImmediatePropagation
on the event to prevent the event from propagating up.
Upvotes: 1