Created
February 21, 2021 22:06
-
-
Save geotheory/3cd12860f800aaa81eda196595a62e3c to your computer and use it in GitHub Desktop.
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
// 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