Skip to content

Instantly share code, notes, and snippets.

@geotheory
Created February 21, 2021 22:06
Show Gist options
  • Save geotheory/3cd12860f800aaa81eda196595a62e3c to your computer and use it in GitHub Desktop.
Save geotheory/3cd12860f800aaa81eda196595a62e3c to your computer and use it in GitHub Desktop.
// stringify an even object for inspection
function stringifyEvent(e) {
const obj = {};
for (let k in e) {
obj[k] = e[k];
}
return JSON.stringify(obj, (k, v) => {
if (v instanceof Node) return 'Node';
if (v instanceof Window) return 'Window';
return v;
}, ' ');
}
document.body.addEventListener('mousemove',function(e){
mouse_report.innerText = stringifyEvent(e);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment