GamepadEvent()

GamepadEvent_ 构造函数用于创建一个新的 GamepadEvent 对象。

语法

var gamepadEvent = new GamepadEvent(typeArg, options)

参数

typeArg
一个 DOMString ,必须为 gamepadconnected 或 gamepaddisconnected
options 可选
选项如下所示:
  • gamepad: 一个 Gamepad 实例,描述了与事件相关的控制器(对象)。

规范

规范 状态 备注
Gamepad
GamepadEvent_
Working Draft 初始定义

浏览器兼容性

 

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Gamepad() constructorChrome Full support 35Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22Safari Full support 10.1WebView Android No support NoChrome Android Full support 35Firefox Android Full support 32Opera Android Full support 22Safari iOS Full support 10.3Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.