interface Event { }; interface Error { }; dictionary EventInit { };
interface Sensor : EventTarget { readonly attribute SensorState state; readonly attribute SensorReading? reading; void start(); void stop(); attribute EventHandler onchange; attribute EventHandler onstatechange; attribute EventHandler onerror; }; dictionary SensorOptions { double? frequency; }; enum SensorState { "idle", "activating", "active", "errored" }; interface SensorReading { readonly attribute DOMHighResTimeStamp timeStamp; }; [Constructor(DOMString type, SensorReadingEventInit eventInitDict)] interface SensorReadingEvent : Event { readonly attribute SensorReading reading; }; dictionary SensorReadingEventInit : EventInit { SensorReading reading; }; [Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)] interface SensorErrorEvent : Event { readonly attribute Error error; }; dictionary SensorErrorEventInit : EventInit { Error error; };
[Constructor(optional SensorOptions sensorOptions)] interface AmbientLightSensor : Sensor { readonly attribute AmbientLightSensorReading? reading; }; [Constructor(AmbientLightSensorReadingInit ambientLightSensorReadingInit)] interface AmbientLightSensorReading : SensorReading { readonly attribute unrestricted double illuminance; }; dictionary AmbientLightSensorReadingInit { unrestricted double illuminance; };