Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Navigator.getGamepads()

이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

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.

Syntax

 var arrayGP = navigator.getGamepads();

Example

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);
});

Specifications

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

Browser compatibility

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

21.0 webkit
35.0

29.0 (29.0) [1] Not supported

15.0 webkit
22.0

Not supported
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
General support Not supported Not supported Not supported Not supported Not supported

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

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: chrisdavidmills, teoli
 최종 변경: chrisdavidmills,