Gamepad

open class Gamepad(source)

The Gamepad interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.

MDN Reference

Properties

Link copied to clipboard
open external val axes: ReadonlyArray<JsDouble>

The axes read-only property of the Gamepad interface returns an array representing the controls with axes present on the device (e.g., analog thumb sticks).

Link copied to clipboard
open external val buttons: ReadonlyArray<GamepadButton>

The buttons read-only property of the Gamepad interface returns an array of GamepadButton objects representing the buttons present on the device.

Link copied to clipboard
open external val connected: Boolean

The connected read-only property of the Gamepad interface returns a boolean indicating whether the gamepad is still connected to the system.

Link copied to clipboard
open external val id: String

The id read-only property of the Gamepad interface returns a string containing some information about the controller.

Link copied to clipboard
open external val index: Int

The index read-only property of the Gamepad interface returns an integer that is auto-incremented to be unique for each device currently connected to the system.

Link copied to clipboard
open external val mapping: GamepadMappingType

The mapping read-only property of the Gamepad interface returns a string indicating whether the browser has remapped the controls on the device to a known layout.

Link copied to clipboard
open external val timestamp: DOMHighResTimeStamp

The timestamp read-only property of the Gamepad interface returns a DOMHighResTimeStamp representing the last time the data for this gamepad was updated.

Link copied to clipboard

The vibrationActuator read-only property of the Gamepad interface returns a GamepadHapticActuator object, which represents haptic feedback hardware available on the controller.