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/. */
6 [Pref="dom.gamepad.enabled"]
7 interface GamepadButton {
8 readonly attribute boolean pressed;
9 readonly attribute double value;
12 enum GamepadMappingType {
17 [Pref="dom.gamepad.enabled"]
20 * An identifier, unique per type of device.
22 readonly attribute DOMString id;
25 * The game port index for the device. Unique per device
26 * attached to this system.
28 readonly attribute unsigned long index;
31 * The mapping in use for this device. The empty string
32 * indicates that no mapping is in use.
34 readonly attribute GamepadMappingType mapping;
37 * true if this gamepad is currently connected to the system.
39 readonly attribute boolean connected;
42 * The current state of all buttons on the device, an
43 * array of GamepadButton.
45 [Pure, Cached, Frozen]
46 readonly attribute sequence<GamepadButton> buttons;
49 * The current position of all axes on the device, an
52 [Pure, Cached, Frozen]
53 readonly attribute sequence<double> axes;