Gamepad: connected property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Gamepad API")}}
The **connected** read-only property of the {{domxref("Gamepad")}} interface returns a boolean indicating whether the gamepad is still connected to the system.
If the gamepad is connected, the value is true; if not, it is false.
Value
A boolean.
Examples
js
const gp = navigator.getGamepads()[0];
console.log(gp.connected);Specifications
{{Specifications}}
Browser compatibility
{{Compat}}