DeviceMotionEvent.webidl (2350B)
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/. 5 * 6 * https://w3c.github.io/deviceorientation/ 7 */ 8 9 [LegacyNoInterfaceObject, 10 Exposed=Window] 11 interface DeviceAcceleration { 12 readonly attribute double? x; 13 readonly attribute double? y; 14 readonly attribute double? z; 15 }; 16 17 [LegacyNoInterfaceObject, 18 Exposed=Window] 19 interface DeviceRotationRate { 20 readonly attribute double? alpha; 21 readonly attribute double? beta; 22 readonly attribute double? gamma; 23 }; 24 25 [Pref="device.sensors.motion.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", 26 Exposed=Window] 27 interface DeviceMotionEvent : Event { 28 constructor(DOMString type, 29 optional DeviceMotionEventInit eventInitDict = {}); 30 31 readonly attribute DeviceAcceleration? acceleration; 32 readonly attribute DeviceAcceleration? accelerationIncludingGravity; 33 readonly attribute DeviceRotationRate? rotationRate; 34 readonly attribute double? interval; 35 }; 36 37 dictionary DeviceAccelerationInit { 38 double? x = null; 39 double? y = null; 40 double? z = null; 41 }; 42 43 dictionary DeviceRotationRateInit { 44 double? alpha = null; 45 double? beta = null; 46 double? gamma = null; 47 }; 48 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; 57 }; 58 59 // Mozilla extensions. 60 partial interface DeviceMotionEvent { 61 undefined 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); 68 };