Created
February 10, 2018 22:08
-
-
Save paulanunda/7f6ddc0d8031f5ac69bd50f732fd8468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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