- From: Mounir Lamouri <mounir@lamouri.fr>
- Date: Fri, 15 Aug 2014 23:14:45 +1000
- To: Jonas Sicking <jonas@sicking.cc>, Marcos Caceres <w3c@marcosc.com>
- Cc: WHAT Working Group <whatwg@lists.whatwg.org>
On Thu, 14 Aug 2014, at 11:00, Jonas Sicking wrote: > I am however more worried about that only having a request() and a > release() function means that pages that contain multiple independent > subsystems will have to make sure that they don't stomp on each > other's locks. Simply counting request() calls vs. release() calls > helps, but doesn't fully solve the problem. It's very easy to > accidentally call release too many times, in response to some UI > action for example. > > 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. It seems that we already discussed using an object and this solution was dismissed because of this model being error-prone. It's also not clear how this solution is superior than the current solution [1] with regards to multiple releases or requests. In [1], if you call .request() or .release() multiple time, the promise reacts appropriately. Typically, if you try to release() an un-hold lock, it will reject the promise. Is that something you are not satisfied with? [1] http://w3c.github.io/wake-lock/ ? -- Mounir
Received on Friday, 15 August 2014 13:15:16 UTC