Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!
Można także przeczytać artykuł w języku: English (US).

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Navigator.getGamepads() method returns an array: the first value is null, and the others are all Gamepad objects, one for each gamepad connected to the device. So if no gamepads are connected, the method will just return null.


 var arrayGP = navigator.getGamepads();


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


Specification Status Comment
The definition of 'The Gamepad API specification' in that specification.
Working Draft Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
General support

21.0 webkit

(Yes) 29.0 (29.0) [1] No support

15.0 webkit

No support
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
General support No support (Yes) No support No support No support No support

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

See also

Autorzy i etykiety dokumentu

Autorzy tej strony: Nektro, abbycar, chrisdavidmills, teoli
Ostatnia aktualizacja: Nektro,