blob: 5222968bccdf644ee68272b32e3246bc3c348a21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
---
title: GamepadButton.pressed
slug: Web/API/GamepadButton/pressed
translation_of: Web/API/GamepadButton/pressed
---
<p>{{APIRef("Gamepad API")}}</p>
<p>Свойство <code><strong>GamepadButton.pressed</strong></code> интерфейса {{domxref("GamepadButton")}} возвращает <code>boolean</code>, указыващий, нажата ли текущая кнопка (<code>true</code>), или нет (<code>false</code>).</p>
<h2 id="Синтакс">Синтакс</h2>
<pre class="syntaxbox notranslate"><span class="idlInterface" id="idl-def-GamepadButton"><span class="idlAttribute">var isPressed = navigator.getGamepads()[0].pressed;
</span></span></pre>
<h2 id="Пример">Пример</h2>
<pre class="brush: js notranslate">var gp = navigator.getGamepads()[0]; // Get the first gamepad object
if(gp.buttons[0].pressed == true) {
// respond to button being pressed
}</pre>
<h2 id="Значение">Значение</h2>
<p> {{domxref("boolean")}}.</p>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName("Gamepad", "#dom-gamepadbutton-pressed", "GamepadButton.pressed")}}</td>
<td>{{Spec2("Gamepad")}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("api.GamepadButton.pressed")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/Guide/API/Gamepad">Using the Gamepad API</a></li>
</ul>
|