I have a problem and I need to find a solution. :D
So here's my code:
var inputEnabled = true
var pressedKey = {}
window.addEventListener('keydown',function(e) {
pressedKey[e.keyCode || e.which] = true;
}, true);
window.addEventListener('keyup',function(e) {
pressedKey[e.keyCode || e.which] = false;
}, true);
function keyBinding() {
if (*my problem*) {
loadMenu()
}
if (inputEnabled == true) {
setTimeout("keyBinding()", 25)
}
}
What I want is that when any key is pressed I want to load a menu but I don't what how am I supposed to detect that key press.
Any help would be appreciated.