Gamepad API - Web APIs | MDN
Interfaces
Gamepad-
Represents a gamepad/controller connected to the computer.
-
Represents a button on one of the connected controllers.
GamepadEvent-
The event object representing events fired that are related to gamepads.
Experimental Gamepad extensions
GamepadHapticActuator-
Represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.
GamepadPose-
Represents the pose of a controller (e.g., position and orientation in 3D space) in the case of a WebVR controller. This is not used by the newer WebXR standard.
Extensions to other interfaces
Navigator
-
An extension to the
Navigatorobject that returns an array ofGamepadobjects, one for each connected gamepad.
Window events
gamepadconnected-
An event that will fire when a gamepad is connected.
gamepaddisconnected-
An event that will fire when a gamepad is disconnected.
Tutorials and guides
Specifications
| Specification |
|---|
| Gamepad # gamepad-interface |
| Gamepad Extensions # partial-gamepad-interface |
Browser compatibility
See also
- The Gamepad API by Ted Mielczarek and Robert Nyman
- Simple API demo page (source)