2013-04-09 12:43:24 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-04-09 12:43:25 +00: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
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2013-10-17 19:07:19 +00:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
|
|
|
interface GamepadButton {
|
|
|
|
readonly attribute boolean pressed;
|
|
|
|
readonly attribute double value;
|
|
|
|
};
|
|
|
|
|
2014-05-23 11:39:13 +00:00
|
|
|
enum GamepadMappingType {
|
|
|
|
"",
|
|
|
|
"standard"
|
|
|
|
};
|
|
|
|
|
2013-04-09 12:43:24 +00:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
2013-04-09 12:43:25 +00: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 12:43:25 +00:00
|
|
|
/**
|
|
|
|
* The mapping in use for this device. The empty string
|
|
|
|
* indicates that no mapping is in use.
|
|
|
|
*/
|
2014-05-23 11:39:13 +00:00
|
|
|
readonly attribute GamepadMappingType mapping;
|
2013-04-09 12:43:25 +00:00
|
|
|
|
2013-04-09 12:43:25 +00: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 19:07:19 +00:00
|
|
|
* array of GamepadButton.
|
2013-04-09 12:43:25 +00:00
|
|
|
*/
|
2013-12-16 18:06:35 +00:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 16:41:13 +00:00
|
|
|
readonly attribute sequence<GamepadButton> buttons;
|
2013-04-09 12:43:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current position of all axes on the device, an
|
|
|
|
* array of doubles.
|
|
|
|
*/
|
2013-12-16 18:06:35 +00:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 16:41:13 +00:00
|
|
|
readonly attribute sequence<double> axes;
|
2015-01-07 19:17:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Timestamp from when the data of this device was last updated.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMHighResTimeStamp timestamp;
|
2013-04-09 12:43:25 +00:00
|
|
|
};
|