API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

E

enumKeyboard

@codexo/exojs / input / stable

Channel indices for keyboard keys, addressed by PHYSICAL key position. Pass any value to the Input constructor to react to that key. A key is identified by the Web platform's layout-independent `KeyboardEvent.code` (see keyboardChannelFromCode), not by the layout-dependent `keyCode`: Keyboard.A is the key at the QWERTY "A" position on every layout - the one an AZERTY keyboard prints "Q" on - so WASD-style bindings stay in the same place under the player's hand regardless of the player's layout. Every member therefore names a POSITION, described by the glyph a US-QWERTY keyboard prints there, and NOT the character the key actually produces: Keyboard.Z is the key a German QWERTZ keyboard prints "Y" on, and Keyboard.Semicolon the key it prints "ö" on. Use DOM text input for anything that needs the typed character, dead keys, or IME composition. The values are opaque channel indices inside the keyboard category - do not assume they equal any `keyCode`. Each modifier has both a side-specific channel (`ShiftLeft`, `ShiftRight`, `ControlLeft`, `ControlRight`, `AltLeft`, `AltRight`, `MetaLeft`, `MetaRight`) and an aggregate one (`Shift`, `Control`, `Alt`, `Meta`) that is active whenever either side is held - the aggregate is what a game binding wants ("was Control held", regardless of which hand), while the side-specific channels exist for a key-press visualizer or a rebinding UI that needs to tell the two physical keys apart. Releasing one side while the other stays held keeps the aggregate active.

0
props
0
methods
0
events
Import
import { Keyboard } from '@codexo/exojs'

Channel indices for keyboard keys, addressed by PHYSICAL key position. Pass any value to the Input constructor to react to that key.

A key is identified by the Web platform's layout-independent `KeyboardEvent.code` (see keyboardChannelFromCode), not by the layout-dependent `keyCode`: Keyboard.A is the key at the QWERTY "A" position on every layout - the one an AZERTY keyboard prints "Q" on - so WASD-style bindings stay in the same place under the player's hand regardless of the player's layout.

Every member therefore names a POSITION, described by the glyph a US-QWERTY keyboard prints there, and NOT the character the key actually produces: Keyboard.Z is the key a German QWERTZ keyboard prints "Y" on, and Keyboard.Semicolon the key it prints "ö" on. Use DOM text input for anything that needs the typed character, dead keys, or IME composition.

The values are opaque channel indices inside the keyboard category - do not assume they equal any `keyCode`.

Each modifier has both a side-specific channel (`ShiftLeft`, `ShiftRight`, `ControlLeft`, `ControlRight`, `AltLeft`, `AltRight`, `MetaLeft`, `MetaRight`) and an aggregate one (`Shift`, `Control`, `Alt`, `Meta`) that is active whenever either side is held - the aggregate is what a game binding wants ("was Control held", regardless of which hand), while the side-specific channels exist for a key-press visualizer or a rebinding UI that needs to tell the two physical keys apart. Releasing one side while the other stays held keeps the aggregate active.

Members113
A
Alt
AltLeft
AltRight
B
Backquote
Backslash
Backspace
BracketLeft
BracketRight
C
CapsLock
Comma
ContextMenu
Control
ControlLeft
ControlRight
D
Delete
Down
E
Eight
End
Enter
Equal
Escape
F
F1
F10
F11
F12
F2
F3
F4
F5
F6
F7
F8
F9
Five
Four
G
H
Help
Home
I
Insert
IntlBackslash
IntlRo
IntlYen
J
K
L
Left
M
Meta
MetaLeft
MetaRight
Minus
N
Nine
NumLock
NumPad0
NumPad1
NumPad2
NumPad3
NumPad4
NumPad5
NumPad6
NumPad7
NumPad8
NumPad9
NumPadAdd
NumPadDecimal
NumPadDivide
NumPadEnter
NumPadEqual
NumPadMultiply
NumPadSubtract
O
One
P
PageDown
PageUp
Pause
Period
PrintScreen
Q
Quote
R
Right
S
ScrollLock
Semicolon
Seven
Shift
ShiftLeft
ShiftRight
Six
Slash
Space
T
Tab
Three
Two
U
Up
V
W
X
Y
Z
Zero
Source