Created
August 10, 2019 14:20
-
-
Save TunedMystic/5c2e87ad015be6f66c0e782201efe324 to your computer and use it in GitHub Desktop.
See all event listeners on the page.
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
// See all event listeners on the page. | |
// Ref: https://stackoverflow.com/a/45842339 | |
// | |
Array.from(document.querySelectorAll('*')) | |
.reduce(function(pre, dom){ | |
var evtObj = getEventListeners(dom) | |
Object.keys(evtObj).forEach(function (evt) { | |
if (typeof pre[evt] === 'undefined') { | |
pre[evt] = 0 | |
} | |
pre[evt] += evtObj[evt].length | |
}) | |
return pre | |
}, {}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment