2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-04-09 16:43:25 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2016-11-14 12:28:48 +03:00
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* https://w3c.github.io/gamepad/
|
|
|
|
* https://w3c.github.io/gamepad/extensions.html
|
2017-07-14 11:53:03 +03:00
|
|
|
* https://w3c.github.io/webvr/spec/1.1/#interface-gamepad
|
2016-11-14 12:28:48 +03:00
|
|
|
*/
|
2013-04-09 16:43:25 +04:00
|
|
|
|
2013-10-17 23:07:19 +04:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
|
|
|
interface GamepadButton {
|
|
|
|
readonly attribute boolean pressed;
|
2017-04-06 13:36:46 +03:00
|
|
|
readonly attribute boolean touched;
|
2013-10-17 23:07:19 +04:00
|
|
|
readonly attribute double value;
|
|
|
|
};
|
|
|
|
|
2016-11-14 12:28:48 +03:00
|
|
|
enum GamepadHand {
|
|
|
|
"",
|
|
|
|
"left",
|
|
|
|
"right"
|
|
|
|
};
|
|
|
|
|
2014-05-23 15:39:13 +04:00
|
|
|
enum GamepadMappingType {
|
|
|
|
"",
|
|
|
|
"standard"
|
|
|
|
};
|
|
|
|
|
2013-04-09 16:43:24 +04:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
2013-04-09 16:43:25 +04:00
|
|
|
interface Gamepad {
|
|
|
|
/**
|
|
|
|
* An identifier, unique per type of device.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The game port index for the device. Unique per device
|
|
|
|
* attached to this system.
|
|
|
|
*/
|
|
|
|
readonly attribute unsigned long index;
|
|
|
|
|
2013-04-09 16:43:25 +04:00
|
|
|
/**
|
|
|
|
* The mapping in use for this device. The empty string
|
|
|
|
* indicates that no mapping is in use.
|
|
|
|
*/
|
2014-05-23 15:39:13 +04:00
|
|
|
readonly attribute GamepadMappingType mapping;
|
2013-04-09 16:43:25 +04:00
|
|
|
|
2016-11-14 12:28:48 +03:00
|
|
|
/**
|
|
|
|
* The hand in use for this device. The empty string
|
|
|
|
* indicates that unknown, both hands, or not applicable
|
|
|
|
*/
|
|
|
|
[Pref="dom.gamepad.extensions.enabled"]
|
|
|
|
readonly attribute GamepadHand hand;
|
|
|
|
|
2017-07-14 11:53:03 +03:00
|
|
|
/**
|
|
|
|
* The displayId in use for as an association point in the VRDisplay API
|
|
|
|
* to identify which VRDisplay that the gamepad is associated with.
|
|
|
|
*/
|
|
|
|
[Pref="dom.vr.enabled"]
|
|
|
|
readonly attribute unsigned long displayId;
|
|
|
|
|
2013-04-09 16:43:25 +04:00
|
|
|
/**
|
|
|
|
* true if this gamepad is currently connected to the system.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean connected;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current state of all buttons on the device, an
|
2013-10-17 23:07:19 +04:00
|
|
|
* array of GamepadButton.
|
2013-04-09 16:43:25 +04:00
|
|
|
*/
|
2013-12-16 22:06:35 +04:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 20:41:13 +04:00
|
|
|
readonly attribute sequence<GamepadButton> buttons;
|
2013-04-09 16:43:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current position of all axes on the device, an
|
|
|
|
* array of doubles.
|
|
|
|
*/
|
2013-12-16 22:06:35 +04:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 20:41:13 +04:00
|
|
|
readonly attribute sequence<double> axes;
|
2015-01-07 22:17:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Timestamp from when the data of this device was last updated.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMHighResTimeStamp timestamp;
|
2016-10-24 13:04:41 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current pose of the device, a GamepadPose.
|
|
|
|
*/
|
|
|
|
[Pref="dom.gamepad.extensions.enabled"]
|
|
|
|
readonly attribute GamepadPose? pose;
|
2017-02-02 09:30:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current haptic actuator of the device, an array of
|
|
|
|
* GamepadHapticActuator.
|
|
|
|
*/
|
|
|
|
[Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"]
|
|
|
|
readonly attribute sequence<GamepadHapticActuator> hapticActuators;
|
2019-05-30 01:44:24 +03:00
|
|
|
|
|
|
|
[Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.lightindicator"]
|
|
|
|
readonly attribute sequence<GamepadLightIndicator> lightIndicators;
|
|
|
|
|
|
|
|
[Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.multitouch"]
|
|
|
|
readonly attribute sequence<GamepadTouch> touchEvents;
|
2013-04-09 16:43:25 +04:00
|
|
|
};
|