-
-
Save plugn/b27ee1657caf9e3cfb09bf482a2f8a27 to your computer and use it in GitHub Desktop.
Get all event listeners on page
This file contains hidden or 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
window.getAllEventListeners = () => { | |
return Array.from(document.querySelectorAll('*')).map(element => { | |
const listeners = getEventListeners(element); | |
return { | |
element: element, | |
listeners: Object.keys(listeners).map(key => { | |
return { | |
event: key, | |
listeners: listeners[key] | |
}; | |
}) | |
}; | |
}).filter(item => item.listeners.length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment