Skip to content

Instantly share code, notes, and snippets.

@paulanunda
Created February 10, 2018 22:08
Show Gist options
  • Save paulanunda/7f6ddc0d8031f5ac69bd50f732fd8468 to your computer and use it in GitHub Desktop.
Save paulanunda/7f6ddc0d8031f5ac69bd50f732fd8468 to your computer and use it in GitHub Desktop.
function removeEventListeners(element, listenerMap) {
Object.keys(listenerMap).forEach(function (name) {
var listeners = listenerMap[name];
listeners.forEach(function (object) {
element.removeEventListener(name, object.listener);
});
});
};
removeEventListeners(window, getEventListeners(window));
removeEventListeners(document, getEventListeners(document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment