nx.js
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

PropertyModifierTypeDescription
axesreadonlyreadonly number[]MDN Reference
buttonsreadonlyreadonly GamepadButton[]MDN Reference
connectedreadonlybooleanMDN Reference
deviceTypereadonlynumber-
idreadonlystringA 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>".
indexreadonlynumberMDN Reference
mappingreadonlyGamepadMappingTypeMDN Reference
rawButtonsreadonlybigint-
styleSetreadonlynumber-
timestampreadonlynumberMDN Reference
vibrationActuatorreadonlyGamepadHapticActuatorMDN Reference

On this page