MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

gamepadconnected

这篇翻译不完整。请帮忙从英语翻译这篇文章

gamepadconnected 事件会在浏览器检测到游戏控制器第一次连接或者第一次按下游戏键/摇杆的时候触发。

基本信息

文档
Gamepad
类型
事件
冒泡
No
可取消
No
Target
DefaultView (<window>)
默认操着

属性

Property Type Description
target 只读 EventTarget The event target (the topmost target in the DOM tree).
type 只读 DOMString The type of event.
bubbles 只读 Boolean Whether the event normally bubbles or not
cancelable 只读 Boolean Whether the event is cancellable or not?
gampad 只读 Gamepad The single gamepad attribute provides access to the associated gamepad data for this event.

示例

// Note that the API is still vendor-prefixed in browsers implementing it
window.addEventListener("gamepadconnected", function( event ) {

    // All buttons and axes values can be accessed through
    event.gamepad;

});

相关事件

还可以参考

文档标签和贡献者

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