HTML:標記語言
CSS:樣式語言
JavaScript:指令碼語言
Web API:程式設計介面
所有 Web 技術
學習 Web 開發
發現我們的工具
更好地瞭解 MDN
此特性已得到良好確立,可跨多種裝置和瀏覽器版本使用。自 2017 年 3 月起,所有瀏覽器均支援此特性。
安全上下文: 此功能僅在安全上下文(HTTPS)中可用,且支援此功能的瀏覽器數量有限。
GamepadButton.pressed 屬性是 GamepadButton 介面的一部分,返回一個 boolean 值,指示按鈕當前是否被按下(true)或未被按下(false)。
GamepadButton.pressed
GamepadButton
boolean
true
false
let gp = navigator.getGamepads()[0]; // Get the first gamepad object if (gp.buttons[0].pressed) { // respond to button being pressed }
一個布林值。
載入中…