Created
August 29, 2023 00:35
-
-
Save a7madgamal/81eb4a2fe1826eefc880364a6866eb52 to your computer and use it in GitHub Desktop.
listen to all js events
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
Object.keys(window).forEach((key) => { | |
if (/^on/.test(key)) { | |
const name = key.slice(2); | |
console.log(name); | |
window.addEventListener(name, (event) => { | |
const tag = event[Symbol.toStringTag]; | |
// exclude noisy ones | |
if (!['TransitionEvent', 'MouseEvent', 'PointerEvent', 'AnimationEvent'].includes(tag)) { | |
console.log(event); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment