- From: Alexander Shalamov via GitHub <sysbot+gh@w3.org>
- Date: Mon, 03 Oct 2016 09:51:49 +0000
- To: public-device-apis-log@w3.org
alexshalamov has just created a new issue for https://github.com/w3c/sensors: == Should we use OnErrorEventHandler error handler instead of EventHandler? == The HTML5 specification defines [OnErrorEventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#onerroreventhandler) that can be used instead of custom “EventHandler onerror”. The error [event handler processing algorithm](https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm), [error event](https://html.spec.whatwg.org/multipage/webappapis.html#errorevent) and [OnErrorEventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#onerroreventhandler) interface can be simply reused instead defining custom error handling functionality. Modified version of the IDL for the current Generic Sensor API would look like: ``` interface Sensor : EventTarget { readonly attribute SensorState state; readonly attribute SensorReading? reading; void start(); void stop(); attribute EventHandler onchange; attribute EventHandler onstatechange; attribute OnErrorEventHandler 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; }; ``` Please view or discuss this issue at https://github.com/w3c/sensors/issues/137 using your GitHub account
Received on Monday, 3 October 2016 09:51:55 UTC