Jump to:

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 Event
Event handler property ongamepadconnected

Example

// Note that the API is still vendor-prefixed in browsers implementing it
window.addEventListener("gamepadconnected", function( event ) {

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

});

See also

Document Tags and Contributors

Last updated by: mdnwebdocs-bot,