Window: gamepadconnected event

The gamepadconnected event is fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.

Bubbles No
Cancelable No
Interface GamepadEvent
Event handler property ongamepadconnected

The event will not fire if disallowed by the document's gamepad Feature Policy.

Examples

window.addEventListener('gamepadconnected', event => {

    // All buttons and axes values can be accessed through
    event.gamepad;

});

Specifications

Specification
Gamepad
# the-gamepadconnected-event

Browser compatibility

BCD tables only load in the browser

See also