tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Gamepad.webidl (2923B)


      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 */
     11 
     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;
     18 };
     19 
     20 enum GamepadHand {
     21  "",
     22  "left",
     23  "right"
     24 };
     25 
     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"
     34 };
     35 
     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;
     43 
     44  /**
     45   * The game port index for the device. Unique per device
     46   * attached to this system.
     47   */
     48  readonly attribute long index;
     49 
     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;
     55 
     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;
     62 
     63  /**
     64   * true if this gamepad is currently connected to the system.
     65   */
     66  readonly attribute boolean connected;
     67 
     68  /**
     69   * The current state of all buttons on the device, an
     70   * array of GamepadButton.
     71   */
     72  [Pure, Cached, Frozen]
     73  readonly attribute sequence<GamepadButton> buttons;
     74 
     75  /**
     76   * The current position of all axes on the device, an
     77   * array of doubles.
     78   */
     79  [Pure, Cached, Frozen]
     80  readonly attribute sequence<double> axes;
     81 
     82  /**
     83   * Timestamp from when the data of this device was last updated.
     84   */
     85  readonly attribute DOMHighResTimeStamp timestamp;
     86 
     87  /**
     88   * The current pose of the device, a GamepadPose.
     89   */
     90  [Pref="dom.gamepad.extensions.enabled"]
     91  readonly attribute GamepadPose? pose;
     92 
     93  /**
     94   * The current haptic actuator of the device, an array of
     95   * GamepadHapticActuator.
     96   */
     97  [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"]
     98  readonly attribute sequence<GamepadHapticActuator> hapticActuators;
     99 
    100  [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.lightindicator"]
    101  readonly attribute sequence<GamepadLightIndicator> lightIndicators;
    102 
    103  [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.multitouch"]
    104  readonly attribute sequence<GamepadTouch> touchEvents;
    105 };