W3C home > Mailing lists > Public > public-device-apis@w3.org > April 2013

Re: Ambient Light Events: why two events?

From: Doug Turner <dougt@mozilla.com>
Date: Fri, 19 Apr 2013 22:08:04 +0200
Message-ID: <5171A424.4000402@mozilla.com>
To: "Kostiainen, Anssi" <anssi.kostiainen@intel.com>
CC: Anne van Kesteren <annevk@annevk.nl>, ext Doug Turner <doug.turner@gmail.com>, "<public-device-apis@w3.org>" <public-device-apis@w3.org>
+1 to combining the events.  Keep in mind that we separated the 
proximity sensor events into one that reports distance and one that 
reports a text (near, far).  We probably should fix that one too.

Should the LightLevelState be optional?  A minor concern is that we do 
have a number of devices in the field that already support this event 
without this attribute.

Doug


> Kostiainen, Anssi <mailto:anssi.kostiainen@intel.com>
> April 18, 2013 8:50 AM
> Hi Anne, Doug,
>
>
> Doug - you added LightLevelEvent to the spec [1,2], but it appears it 
> has not been implemented yet [3] as per the spec [4].
>
> Anne is proposing we expose the LightLevelState value on 
> DeviceLightEvent. Only downside I see is that the event may fire more 
> frequently than needed if you're only interested in the value of the 
> state. Other than that, I think this makes the API simpler and more 
> developer-friendly -- which I think -- is also one of your main goals 
> while designing APIs.
>
> Here's the new IDL I propose based on Anne's feedback:
>
> [[
>
> partial interface Window {
> attribute EventHandler ondevicelight;
> };
>
> enum LightLevelState { "", "dim", "normal", "bright" };
>
> dictionary DeviceLightEventInit : EventInit {
> double value;
> LightLevelState state;
> };
>
> [Constructor (DOMString type, optional DeviceLightEventInit 
> eventInitDict)]
> interface DeviceLightEvent : Event {
> readonly attribute unrestricted double value;
> readonly attribute LightLevelState state;
> };
>
> ]]
>
> Doug, Anne, All - let me know if you have any concerns with the 
> proposed change. I'm happy to bake this in to the spec once we reach 
> consensus. Also, please let me know if you spot any spec bugs.
>
> Thanks,
>
> -Anssi
>
> [1] 
> http://lists.w3.org/Archives/Public/public-device-apis/2012Sep/0062.html
> [2] 
> http://lists.w3.org/Archives/Public/public-device-apis/2012Sep/0063.html
> [3] https://bugzil.la/842952
> [4] https://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html
>
>
> Anne van Kesteren <mailto:annevk@annevk.nl>
> April 12, 2013 5:03 PM
> If LightLevelEvent expresses in a string what DeviceLightEvent
> expresses in more detail as a double, LightLevelEvent should just go
> away. At the very best you could expose it on DeviceLightEvent I
> suppose as a convenience.
>
>
> --
> http://annevankesteren.nl/
>
Received on Friday, 19 April 2013 20:08:39 UTC

This archive was generated by hypermail 2.3.1 : Friday, 19 April 2013 20:08:40 UTC