Bug 1841281 - Disable test_basics.html on mac debug and windows for frequent failures...
[gecko.git] / dom / webidl / Gamepad.webidl
bloba8ec894441d38653c0e3ccd44aa72650ccddfb4b
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * https://w3c.github.io/gamepad/
8  * https://w3c.github.io/gamepad/extensions.html
9  * https://w3c.github.io/webvr/spec/1.1/#interface-gamepad
10  */
12 [Pref="dom.gamepad.enabled",
13  Exposed=Window,
14  SecureContext]
15 interface GamepadButton {
16   readonly    attribute boolean pressed;
17   readonly    attribute boolean touched;
18   readonly    attribute double  value;
21 enum GamepadHand {
22   "",
23   "left",
24   "right"
27 /**
28  * https://www.w3.org/TR/gamepad/#gamepadmappingtype-enum
29  * https://immersive-web.github.io/webxr-gamepads-module/#enumdef-gamepadmappingtype
30  */
31 enum GamepadMappingType {
32   "",
33   "standard",
34   "xr-standard"
37 [Pref="dom.gamepad.enabled",
38  Exposed=Window,
39  SecureContext]
40 interface Gamepad {
41   /**
42    * An identifier, unique per type of device.
43    */
44   readonly attribute DOMString id;
46   /**
47    * The game port index for the device. Unique per device
48    * attached to this system.
49    */
50   readonly attribute long index;
52   /**
53    * The mapping in use for this device. The empty string
54    * indicates that no mapping is in use.
55    */
56   readonly attribute GamepadMappingType mapping;
58   /**
59    * The hand in use for this device. The empty string
60    * indicates that unknown, both hands, or not applicable
61    */
62   [Pref="dom.gamepad.extensions.enabled"]
63   readonly attribute GamepadHand hand;
65   /**
66    * The displayId in use for as an association point in the VRDisplay API
67    * to identify which VRDisplay that the gamepad is associated with.
68    */
69   [Pref="dom.vr.enabled"]
70   readonly attribute unsigned long displayId;
72   /**
73    * true if this gamepad is currently connected to the system.
74    */
75   readonly attribute boolean connected;
77   /**
78    * The current state of all buttons on the device, an
79    * array of GamepadButton.
80    */
81   [Pure, Cached, Frozen]
82   readonly attribute sequence<GamepadButton> buttons;
84   /**
85    * The current position of all axes on the device, an
86    * array of doubles.
87    */
88   [Pure, Cached, Frozen]
89   readonly attribute sequence<double> axes;
91   /**
92    * Timestamp from when the data of this device was last updated.
93    */
94   readonly attribute DOMHighResTimeStamp timestamp;
96   /**
97    * The current pose of the device, a GamepadPose.
98    */
99   [Pref="dom.gamepad.extensions.enabled"]
100   readonly attribute GamepadPose? pose;
102   /**
103    * The current haptic actuator of the device, an array of
104    * GamepadHapticActuator.
105    */
106   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"]
107   readonly attribute sequence<GamepadHapticActuator> hapticActuators;
109   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.lightindicator"]
110   readonly attribute sequence<GamepadLightIndicator> lightIndicators;
112   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.multitouch"]
113   readonly attribute sequence<GamepadTouch> touchEvents;