Window.ongamepadconnected

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The ongamepadconnected property of the Window interface represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires).

The event object is of type GamepadEvent.

Syntax

window.ongamepadconnected = function() { ... };

Examples

window.ongamepadconnected = function(event) {
  // All buttons and axes values can be accessed through
  event.gamepad;
};

Specifications

Specification Status Comment
Unknown
The definition of 'gamepadconnected event' in that specification.
Working Draft Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
General support 21.0 webkit
35.0
(Yes) 29.0 (29.0) No support 15.0 webkit
22.0
10.1
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Samsung Internet
General support No support (Yes) 32.0 (32.0) No support No support No support Yes

See also

文档标签和贡献者

 此页面的贡献者: chrisdavidmills
 最后编辑者: chrisdavidmills,