This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. Available only in secure contexts.

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

Properties

axes: readonly number[]
buttons: readonly GamepadButton[]
connected: boolean
hapticActuators: readonly GamepadHapticActuator[]
id: string
index: number
timestamp: number