Move hotkey listener from anonymous to named function.

This commit is contained in:
voussoir 2020-08-30 17:53:11 -07:00
parent 48a63a099b
commit 90873c648b

View file

@ -57,10 +57,9 @@ function show_all_hotkeys()
alert(lines);
}
window.addEventListener(
"keydown",
function(event)
{
hotkeys.hotkeys_listener =
function hotkeys_listener(event)
{
if (hotkeys.should_prevent_hotkey(event)) { return; }
identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey);
console.log(identifier);
@ -69,7 +68,8 @@ window.addEventListener(
hotkeys.HOTKEYS[identifier]["action"]();
event.preventDefault();
}
}
);
}
window.addEventListener("keydown", hotkeys.hotkeys_listener);
hotkeys.register_hotkey("/", 0, 0, 0, hotkeys.show_all_hotkeys, "Show hotkeys.");