gamepadconnected

gamepadconnected イベントは、ゲームパッドが接続されたことをブラウザが検出したとき、またはゲームパッドのボタン/軸が初めて使用されたときに発生します。

一般的な情報

仕様

Gamepad

インターフェース

Event

バブリング

No

キャンセル可能

No

対象

DefaultView (<window>)

標準の動作

None

属性

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.
gamepad 読取専用 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;

});

関連するイベント

参照