Re: [whatwg] Proposal: Wake Lock API

On Tue, Aug 19, 2014 at 1:29 PM, Marcos Caceres <w3c@marcosc.com> wrote:
> interface WakeLock : EventTarget {
>    Promise<void> request();
>    Promise<void> release();
>    attribute EventHandler onlost;
> }

What are the use cases for onlost?

Though I don't really mind exposing this state. My experience is that
if any sane implementation strategy will need to keep some specific
state, and that state affects the behavior of the API, then eventually
someone will come up with a use case for exposing it. And that
exposing it is really easy anyway.

However I think what we'd need is something like

  readonly attribute boolean held;
  attribute EventHandler onheldchange;

FWIW, the web platform sorely needs a construct for "readonly state
variable + event whenever the state changes". I.e. some form of
observable which remembers the last produced value. I had hoped the
Streams would get us closer to that, but the current definition seems
to be too different.

/ Jonas

Received on Wednesday, 20 August 2014 08:29:57 UTC