W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2014

Re: [whatwg] Proposal: Wake Lock API

From: Mounir Lamouri <mounir@lamouri.fr>
Date: Tue, 19 Aug 2014 22:35:47 +1000
Message-Id: <1408451747.421502.154346145.4035D173@webmail.messagingengine.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: WHAT Working Group <whatwg@lists.whatwg.org>, Marcos Caceres <w3c@marcosc.com>
On Tue, 19 Aug 2014, at 04:54, Jonas Sicking wrote:
> Note that in the API that I'm proposing, there is no way to
> accidentally rely on GC behavior. If a WakeLock object is GCed before
> it has been release()ed, then the lock is held indefinitely (until the
> user leaves the page of course).
> 
> I.e. an unbalanced request() and release() in both the currently
> proposed API, and in the API that I propose behave the same, the lock
> is held indefinitely. Any objects getting GCed does not change this.

I overlooked that aspect, my apologies. It sounds good. I am not sure if
that would be safer than global methods in the sense that developers
will still be able to shoot themselves in the foot by not calling
.release() or might assume that .release() will be called upon object
destruction.

How would you handle feature detection with this design?

-- Mounir
Received on Tuesday, 19 August 2014 12:36:16 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:22 UTC