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;
});

相关事件

还可以参考

文档标签和贡献者