JavaScript object literal(s) containing keyboard event key codes.
/**
* JavaScript event key code mappings (basic)
*
* KeyboardEvent.keyCode has been DEPRECATED
*
* web developers shouldn't use the keyCode attribute for printable
* characters when handling keydown and keyup events. As described above,
* the keyCode attribute is not useful for printable characters, especially
* those input with the Shift or Alt key pressed. When implementing a
* shortcut key handler, the keypress event is usually better (at least when
* Gecko is the runtime in use). See Gecko Keypress Event for details.
*
* Source: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
*
* @type {Object}
* @see https://keycode.info/ for additional key codes.
*/
const keyboard = Object.freeze({
BACKSPACE: 8,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESC: 27,
F2: 113,
F10: 121,
F12: 123,
HOME: 36,
INSERT: 45,
LEFT: 37,
NUMPAD_DOT: 110,
NUMPAD_MINUS: 109,
NUMPAD_PLUS: 107,
PAGEDOWN: 34,
PAGEUP: 33,
RIGHT: 39,
SPACEBAR: 32,
TAB: 9,
UP: 38
});
/**
* JavaScript event key code mappings (extensive)
*
* KeyboardEvent.keyCode has been DEPRECATED
*
* web developers shouldn't use the keyCode attribute for printable
* characters when handling keydown and keyup events. As described above,
* the keyCode attribute is not useful for printable characters, especially
* those input with the Shift or Alt key pressed. When implementing a
* shortcut key handler, the keypress event is usually better (at least when
* Gecko is the runtime in use). See Gecko Keypress Event for details.
*
* Source: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
*
* @type {Object}
* @see https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
*/
const keyboard = Object.freeze({
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAUSE_BREAK: 19,
CAPS_LOCK: 20,
ESCAPE: 27,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT_ARROW: 37,
UP_ARROW: 38,
RIGHT_ARROW: 39,
DOWN_ARROW: 40,
INSERT: 45,
DELETE: 46,
ZERO: 48,
ONE: 49,
TWO: 50,
THREE: 51,
FOUR: 52,
FIVE: 53,
SIX: 54,
SEVEN: 55,
EIGHT: 56,
NINE: 57,
A: 65,
B: 66,
C: 67,
D: 68,
E: 69,
F: 70,
G: 71,
H: 72,
I: 73,
J: 74,
K: 75,
L: 76,
M: 77,
N: 78,
O: 79,
P: 80,
Q: 81,
R: 82,
S: 83,
T: 84,
U: 85,
V: 86,
W: 87,
X: 88,
Y: 89,
Z: 90,
LEFT_WINDOW_KEY: 91,
RIGHT_WINDOW_KEY: 92,
SELECT_KEY: 93,
NUMPAD_ZERO: 96,
NUMPAD_ONE: 97,
NUMPAD_TWO: 98,
NUMPAD_THREE: 99,
NUMPAD_FOUR: 100,
NUMPAD_FIVE: 101,
NUMPAD_SIX: 102,
NUMPAD_SEVEN: 103,
NUMPAD_EIGHT: 104,
NUMPAD_NINE: 105,
MULTIPLY: 106,
ADD: 107,
SUBTRACT: 109,
DECIMAL_POINT: 110,
DIVIDE: 111,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
NUM_LOCK: 144,
SCROLL_LOCK: 145,
SEMI_COLON: 186,
EQUAL_SIGN: 187,
COMMA: 188,
DASH: 189,
PERIOD: 190,
FORWARD_SLASH: 191,
GRAVE_ACCENT: 192,
OPEN_BRACKET: 219,
BACK_SLASH: 220,
CLOSE_BRAKET: 221,
SINGLE_QUOTE: 222
});