Last active
January 12, 2020 09:24
-
-
Save nexusstar/f5465150aa3290338ae6c0f0a7f9a708 to your computer and use it in GitHub Desktop.
Log all events on 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
Object.keys(window).forEach(key => { | |
if (/^on/.test(key)) { | |
window.addEventListener(key.slice(2), event => { | |
console.log(event); | |
}); | |
} | |
}); | |
//Note that you can further customize what you want to catch, for example: | |
///^on(key|mouse)/.test(key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment