removeEventListener required a handler developer.mozilla.org/en-US/docs/W...
so, you have to call remove for all listeners and pass the handler function
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What if I have multiple listeners for the same event?
For instance, if five components want to listen to the USER_LOGIN event. If I remove one of the USER_LOGIN listeners, it will remove them all.
You may have multiple listeners, but when you want to remove them you will remove only the last.
TARGET.removeEventListener(eventName, EVENTS[eventName]);
Good point here. Should think about that.
Don't just remove the last added. The user needs complete control.
Usually, this is how I would expect it to be used:
Another variation is:
Simply calling this should remove all listeners:
removeEventListener required a handler
developer.mozilla.org/en-US/docs/W...
so, you have to call remove for all listeners and pass the handler function