I am using the following event listener to capture keypresses:
window.addEventListener("keydown", function(event) {} );
What is the easiest way to get a string which represents the key pressed, like the value of 33 would be “Pg Up”, 84 would be “F5”, 40 would be “Down Arrow” etc… Is there some useful javascript library for this?
This website has a list. It seems it would be pretty easy to convert it to a set of constants or place it into an array.
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
Codes are for US keyboards. In fact, if you just steal their js…