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

interface Gamepad {
    axes: readonly number[];
    buttons: readonly GamepadButton[];
    connected: boolean;
    id: string;
    index: number;
    mapping: GamepadMappingType;
    timestamp: number;
    vibrationActuator: GamepadHapticActuator;
}
Index

Properties

axes: readonly number[]

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

MDN Reference

buttons: readonly GamepadButton[]

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

MDN Reference

connected: boolean

The Gamepad.connected property of the still connected to the system.

MDN Reference

id: string

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

MDN Reference

index: number

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

MDN Reference

The Gamepad.mapping property of the remapped the controls on the device to a known layout.

MDN Reference

timestamp: number

The Gamepad.timestamp property of the representing the last time the data for this gamepad was updated.

MDN Reference

vibrationActuator: GamepadHapticActuator

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

MDN Reference