GamepadButton: pressed-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Sicherer Kontext: Diese Funktion ist nur in sicheren Kontexten (HTTPS) in einigen oder allen unterstützenden Browsern verfügbar.
Die GamepadButton.pressed
-Eigenschaft des GamepadButton
-Interfaces gibt einen boolean
zurück, der anzeigt, ob der Knopf derzeit gedrückt (true
) oder nicht gedrückt (false
) ist.
Beispiele
js
let gp = navigator.getGamepads()[0]; // Get the first gamepad object
if (gp.buttons[0].pressed) {
// respond to button being pressed
}
Wert
Ein boolean-Wert.
Spezifikationen
Specification |
---|
Gamepad # dom-gamepadbutton-pressed |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pressed |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.