GamepadEvent()

The GamepadEvent() constructor creates a new GamepadEvent object.

Syntax

var gamepadEvent = new GamepadEvent(typeArg, options)

Parameters

typeArg
A DOMString that must be one of gamepadconnected or gamepaddisconnected.
options Optional
Options are as follows:
  • gamepad: An instance of Gamepad describing the gamepad associated with the event.

Specifications

Specification Status Comment
Gamepad
The definition of 'GamepadEvent_' in that specification.
Working Draft Initial definition.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
GamepadEvent() constructorChrome Full support 35Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22Safari Full support 10.1WebView Android No support NoChrome Android Full support YesFirefox Android Full support 32Opera Android Full support 22Safari iOS Full support 10.3Samsung Internet Android Full support Yes

Legend

Full support
Full support
No support
No support
User must explicitly enable this feature.
User must explicitly enable this feature.