blob: 4330fec5a59340856ed24d37849f4896c0b584c6 [file] [log] [blame]
Ted Mielczarek634cdba2014-12-11 14:23:301<!doctype html>
2<html>
3<head>
4<title>Manual Gamepad getGamepads polling tests</title>
Raphael Kubo da Costaeea78e62017-08-01 11:22:465<link rel="help" href="https://w3c.github.io/gamepad/#navigator-interface-extension">
Ted Mielczarek634cdba2014-12-11 14:23:306<script src="/resources/testharness.js"></script>
7<script src="/resources/testharnessreport.js"></script>
8<script>
9setup({explicit_timeout: true});
10// Poll until we see a gamepad.
11var id = setInterval(function() {
12 var gamepads = navigator.getGamepads();
13 var found = null;
14 for (var i = 0; i < gamepads.length; i++) {
15 if (gamepads[i]) {
16 found = gamepads[i];
17 break;
18 }
19 }
20 if (found) {
21 clearInterval(id);
22 done();
23 }
24}, 15);
25</script>
26</head>
27<body>
28<p>This test requires a gamepad. Connect one and press any button to start the test.</p>
29</body>
30</html>