Re: [whatwg] Proposal: Wake Lock API

On Wed, Aug 13, 2014 at 9:46 PM, Biju <bijumaillist@gmail.com> wrote:
>
> On 13 August 2014 21:00, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> An alternative design would be something like
>>
>> x = new WakeLock("display");
>> x.request();
>> x.release();
>>
>> Extra calls of either request() or release() are ignored, but pages
>> can create any number of WakeLocks of the same type.
>
> If application made a x.request() then "x" got garbage collected
> system should automatically do x.release();

No. We don't want authors to come to rely on GC to have their locks
released. That would cause very erratic behavior where sometimes the
lock would be held for 2 seconds after the last reference to 'x' was
removed, and sometimes the lock would be held for 30 minutes past that
point.

In other words, it would make GC observable. Not always observable by
the page, but by the user which can be just as bad.

/ Jonas

Received on Thursday, 14 August 2014 07:08:54 UTC