W3cubDocs

/Web APIs

GamepadEvent: GamepadEvent() constructor

The GamepadEvent() constructor creates a new GamepadEvent object.

Syntax

js

new GamepadEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to gamepadconnected or gamepaddisconnected.

options

An object that, in addition of the properties defined in Event(), can have the following properties:

gamepad

A Gamepad object describing the gamepad associated with the event.

Return value

A new GamepadEvent object.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
GamepadEvent 35 12 29 No 22 10.1 37 35 32 22 10.3 3.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GamepadEvent/GamepadEvent