web api overview
Gamepad API
The Gamepad API is a way for developers to access and respond to signals from gamepads and other game controllers in a simple, consistent way. It contains three interfaces, two events and one specialist function, to respond to gamepads being connected and disconnected, and to access other information about the gamepads themselves, and what buttons and other controls are currently being pressed.
Interfaces
Gamepad- : Represents a gamepad/controller connected to the computer.
GamepadButton- : 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
Extensions to other interfaces
Navigator
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
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The Gamepad API by Ted Mielczarek and Robert Nyman
- Simple API demo page (source)