MDN self-hosted library · e01.org

GamepadEvent: GamepadEvent() constructor

Gamepad API

no runnable cells web-api-constructor upstream source

Gamepad API

The GamepadEvent() constructor creates a new GamepadEvent object.

Syntax

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