key2keyCode
code:script.js
export const KEYCODE_MAP = {
Backspace:8,
Tab: 9,
Enter: 13,
Delete: 46,
Escape: 27,
' ': 32,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
ArrowLeft: 37,
ArrowUp: 38,
ArrowRight: 39,
ArrowDown: 40,
// alphabets
...Object.fromEntries(
range('a'.charCodeAt(0), 'z'.charCodeAt(0))
.flatMap((code, i) => [
])
),
// number
// function keys
...Object.fromEntries(range(1, 12).map(i => [F${i}, 112 + i])),
// 記号
':': 186, '*': 186,
';': 187, '+': 187,
'-': 189, '=': 189,
'.': 190, '>': 190,
'/': 191, '?': 191,
'@': 192, '`': 192,
'[': 219, '{': 219,
'\\': 220, '|': 220,
']': 221, '}': 221,
'^': 222, '~': 222,
'_': 226, // Shiftなしの226は\で、\と区別がつかない
};
値の確認
code:js
(async () => {
const {KEYCODE_MAP} = await import('/api/code/takker/key2keyCode/script.js');
console.log(KEYCODE_MAP)
})();
References