Skip to content

Instantly share code, notes, and snippets.

@RobinBoers
Created August 18, 2023 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinBoers/bd9096d2be254caec2f6dfd6666c642d to your computer and use it in GitHub Desktop.
Save RobinBoers/bd9096d2be254caec2f6dfd6666c642d to your computer and use it in GitHub Desktop.
Simple script for listening to all events for an element
let element = window;
Object.keys(window).forEach((key) => {
if (/^on/.test(key)) {
element.addEventListener(key.slice(2), (event) => {
if(event.type.includes("mouse") || event.type.includes("pointer") || event.type.includes("key")) return;
console.log(event);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment