interface Event {
};
interface EventTarget {
};
interface EventHandler {
};
interface Error {
};
dictionary EventInit {
};
[SecureContext]
interface Sensor : EventTarget {
readonly attribute SensorState state;
readonly attribute SensorReading? reading;
void start();
void stop();
attribute EventHandler onchange;
attribute EventHandler onactivate;
attribute EventHandler onerror;
};
dictionary SensorOptions {
double? frequency;
};
enum SensorState {
"idle",
"activating",
"activated",
"errored"
};
[SecureContext]
interface SensorReading {
readonly attribute DOMHighResTimeStamp timeStamp;
};
[SecureContext, Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)]
interface SensorErrorEvent : Event {
readonly attribute Error error;
};
dictionary SensorErrorEventInit : EventInit {
required Error error;
};
[Constructor(optional SensorOptions sensorOptions)]
interface Gyroscope : Sensor {
readonly attribute GyroscopeReading? reading;
};
[Constructor(GyroscopeReadingInit GyroscopeReadingInit)]
interface GyroscopeReading : SensorReading {
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double z;
};
dictionary GyroscopeReadingInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double z = 0;
};