From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/ru/web/api/navigator/getgamepads/index.html | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 files/ru/web/api/navigator/getgamepads/index.html (limited to 'files/ru/web/api/navigator/getgamepads/index.html') diff --git a/files/ru/web/api/navigator/getgamepads/index.html b/files/ru/web/api/navigator/getgamepads/index.html new file mode 100644 index 0000000000..bc5200cbe1 --- /dev/null +++ b/files/ru/web/api/navigator/getgamepads/index.html @@ -0,0 +1,102 @@ +--- +title: Navigator.getGamepads() +slug: Web/API/Navigator/getGamepads +translation_of: Web/API/Navigator/getGamepads +--- +

{{APIRef("Gamepad API")}}{{SeeCompatTable}}

+ +

Navigator.getGamepads() метод, возвращающий массив {{ domxref("Gamepad") }} объектов, по одному для каждого геймпада, подключенному к устройству.

+ +

Синтаксис

+ +
 var arrayGP = navigator.getGamepads();
+ +

Пример

+ +
window.addEventListener("gamepadconnected", function(e) {
+  var gp = navigator.getGamepads()[0];
+  console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
+  gp.index, gp.id,
+  gp.buttons.length, gp.axes.length);
+});
+ +

Спецификации

+ + + + + + + + + + + + + + +
СпецификацияСтатусКомментарий
{{SpecName('Gamepad', '', 'The Gamepad API specification')}}{{Spec2('Gamepad')}}Initial definition.
+ +

Совместимость браузеров

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
General support +

21.0 {{ property_prefix("webkit") }}
+ 35.0

+
{{ CompatGeckoDesktop("29.0") }} [1]{{ CompatNo() }} +

15.0 {{ property_prefix("webkit") }}
+ 22.0

+
{{ CompatNo() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
General support{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
+
+ +

[1] Was available behind a preference since Firefox 24.

+ +

See also

+ + -- cgit v1.2.3-54-g00ecf