API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
enumKeyboard
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.
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.
AAltAltLeftAltRightBBackquoteBackslashBackspaceBracketLeftBracketRightCCapsLockCommaContextMenuControlControlLeftControlRightDDeleteDownEEightEndEnterEqualEscapeFF1F10F11F12F2F3F4F5F6F7F8F9FiveFourGHHelpHomeIInsertIntlBackslashIntlRoIntlYenJKLLeftMMetaMetaLeftMetaRightMinusNNineNumLockNumPad0NumPad1NumPad2NumPad3NumPad4NumPad5NumPad6NumPad7NumPad8NumPad9NumPadAddNumPadDecimalNumPadDivideNumPadEnterNumPadEqualNumPadMultiplyNumPadSubtractOOnePPageDownPageUpPausePeriodPrintScreenQQuoteRRightSScrollLockSemicolonSevenShiftShiftLeftShiftRightSixSlashSpaceTTabThreeTwoUUpVWXYZZero