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 file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * https://w3c.github.io/deviceorientation/
11 interface DeviceAcceleration {
12 readonly attribute double? x;
13 readonly attribute double? y;
14 readonly attribute double? z;
19 interface DeviceRotationRate {
20 readonly attribute double? alpha;
21 readonly attribute double? beta;
22 readonly attribute double? gamma;
25 [Pref="device.sensors.motion.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled",
27 interface DeviceMotionEvent : Event {
28 constructor(DOMString type,
29 optional DeviceMotionEventInit eventInitDict = {});
31 readonly attribute DeviceAcceleration? acceleration;
32 readonly attribute DeviceAcceleration? accelerationIncludingGravity;
33 readonly attribute DeviceRotationRate? rotationRate;
34 readonly attribute double? interval;
37 dictionary DeviceAccelerationInit {
43 dictionary DeviceRotationRateInit {
49 dictionary DeviceMotionEventInit : EventInit {
50 // FIXME: bug 1493860: should this "= {}" be here?
51 DeviceAccelerationInit acceleration = {};
52 // FIXME: bug 1493860: should this "= {}" be here?
53 DeviceAccelerationInit accelerationIncludingGravity = {};
54 // FIXME: bug 1493860: should this "= {}" be here?
55 DeviceRotationRateInit rotationRate = {};
56 double? interval = null;
59 // Mozilla extensions.
60 partial interface DeviceMotionEvent {
61 void initDeviceMotionEvent(DOMString type,
62 optional boolean canBubble = false,
63 optional boolean cancelable = false,
64 optional DeviceAccelerationInit acceleration = {},
65 optional DeviceAccelerationInit accelerationIncludingGravity = {},
66 optional DeviceRotationRateInit rotationRate = {},
67 optional double? interval = null);