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

Re: Ambient Light Events: why two events?

From: Kostiainen, Anssi <anssi.kostiainen@intel.com>
Date: Thu, 18 Apr 2013 06:50:04 +0000
To: Anne van Kesteren <annevk@annevk.nl>, ext Doug Turner <doug.turner@gmail.com>
CC: "<public-device-apis@w3.org>" <public-device-apis@w3.org>
Message-ID: <3BEA0169-2030-47E4-9F04-F5C6CF39CC3D@intel.com>
Hi Anne, Doug,

On Apr 12, 2013, at 6:03 PM, Anne van Kesteren <annevk@annevk.nl> wrote:

> 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.

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
Received on Thursday, 18 April 2013 06:56:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:58 UTC