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 AmbientLightSensor : Sensor {
};
[Constructor(AmbientLightSensorReadingInit ambientLightSensorReadingInit)]
interface AmbientLightSensorReading : SensorReading {
readonly attribute unrestricted double illuminance;
};
dictionary AmbientLightSensorReadingInit {
required unrestricted double illuminance;
};