Classes
Gamepad
Defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.
See
https://developer.mozilla.org/docs/Web/API/Gamepad
Implements
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
axes | readonly | readonly number[] | MDN Reference |
buttons | readonly | readonly GamepadButton[] | MDN Reference |
connected | readonly | boolean | MDN Reference |
deviceType | readonly | number | - |
id | readonly | string | A string identifying the controller. When available (firmware 5.0.0+), this is the controller's device name plus its hardware serial number, e.g. "Nintendo Switch Pro Controller (XAW10012345678)", making it stable and unique per physical controller. The serial is read from the hid:sys service and cached — it is only re-queried when a controller is connected or disconnected, never on the input-polling hot path. When the serial can't be obtained (older firmware, no serial, or a system error) id falls back to a unique-per-slot string of the form "switch-gamepad-<index>". |
index | readonly | number | MDN Reference |
mapping | readonly | GamepadMappingType | MDN Reference |
rawButtons | readonly | bigint | - |
styleSet | readonly | number | - |
timestamp | readonly | number | MDN Reference |
vibrationActuator | readonly | GamepadHapticActuator | MDN Reference |