layout | tags |
---|---|
doc-api.html |
data |
Map human readable names for event.keyCode
s.
// example structure
var map = {
// Element Focus
tab: 9,
// Navigation
left: 37,
up: 38,
// ...
home: 36,
// Action
enter: 13,
escape: 27,
space: 32,
// Function keys
f1: 112,
// ...
// Numeric keys
0: 48,
1: 49,
// ...
'num-0': 96,
'num-1': 97,
// ...
// Latin characters
a: 65,
// ...
z: 90,
};
The map knows the following keys:
a
-z
0
-9
num-0
-num-9
(number block)f1
-f25
(function keys)down
,left
,right
,up
(arrow keys)end
,home
,pageDown
,page-down
,pageUp
,page-up
enter
,escape
,space
,tab
alt
,capsLock
,caps-lock
,ctrl
,meta
,shift
pause
,insert
,delete
,backspace
console.log('keycode of enter', ally.map.keycode.enter);
v1.1.0
replaced the keycommand
bymeta
.v1.1.0
addeda
-z
,0
-9
,num-0
-num-9
,f13
-f25
,page-down
,page-up
,caps-lock
.v1.1.0
added_alias
to resolve multiple keyCodes for the same logical key.
- NOTE: The key
meta
is known by different keyCodes:91
,92
,93
,224
- whichally.map.keycodes.alias.91
helps to resolve. The same is true for numeric keys (0-9) and their counterparts on the numblock.
KeyboardEvent.key
may help deal with this mess in the future.