Bug 1886946: Remove incorrect assertion that buffer is not-pinned. r=sfink
[gecko.git] / dom / webidl / Gamepad.webidl
blobe730d070ee1c69ad56f9f054cbc29500fe5a3128
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 interface GamepadButton {
15   readonly    attribute boolean pressed;
16   readonly    attribute boolean touched;
17   readonly    attribute double  value;
20 enum GamepadHand {
21   "",
22   "left",
23   "right"
26 /**
27  * https://www.w3.org/TR/gamepad/#gamepadmappingtype-enum
28  * https://immersive-web.github.io/webxr-gamepads-module/#enumdef-gamepadmappingtype
29  */
30 enum GamepadMappingType {
31   "",
32   "standard",
33   "xr-standard"
36 [Pref="dom.gamepad.enabled",
37  Exposed=Window]
38 interface Gamepad {
39   /**
40    * An identifier, unique per type of device.
41    */
42   readonly attribute DOMString id;
44   /**
45    * The game port index for the device. Unique per device
46    * attached to this system.
47    */
48   readonly attribute long index;
50   /**
51    * The mapping in use for this device. The empty string
52    * indicates that no mapping is in use.
53    */
54   readonly attribute GamepadMappingType mapping;
56   /**
57    * The hand in use for this device. The empty string
58    * indicates that unknown, both hands, or not applicable
59    */
60   [Pref="dom.gamepad.extensions.enabled"]
61   readonly attribute GamepadHand hand;
63   /**
64    * The displayId in use for as an association point in the VRDisplay API
65    * to identify which VRDisplay that the gamepad is associated with.
66    */
67   [Pref="dom.vr.enabled"]
68   readonly attribute unsigned long displayId;
70   /**
71    * true if this gamepad is currently connected to the system.
72    */
73   readonly attribute boolean connected;
75   /**
76    * The current state of all buttons on the device, an
77    * array of GamepadButton.
78    */
79   [Pure, Cached, Frozen]
80   readonly attribute sequence<GamepadButton> buttons;
82   /**
83    * The current position of all axes on the device, an
84    * array of doubles.
85    */
86   [Pure, Cached, Frozen]
87   readonly attribute sequence<double> axes;
89   /**
90    * Timestamp from when the data of this device was last updated.
91    */
92   readonly attribute DOMHighResTimeStamp timestamp;
94   /**
95    * The current pose of the device, a GamepadPose.
96    */
97   [Pref="dom.gamepad.extensions.enabled"]
98   readonly attribute GamepadPose? pose;
100   /**
101    * The current haptic actuator of the device, an array of
102    * GamepadHapticActuator.
103    */
104   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"]
105   readonly attribute sequence<GamepadHapticActuator> hapticActuators;
107   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.lightindicator"]
108   readonly attribute sequence<GamepadLightIndicator> lightIndicators;
110   [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.multitouch"]
111   readonly attribute sequence<GamepadTouch> touchEvents;