Re: [whatwg] Feature-detectable WakeLocks

On Tue, 19 Aug 2014, at 08:41, Kornel Lesiński wrote:
> WakeLock.request() expecting a string isn't very friendly to feature
> detection. 
> 
> I'd prefer if individual lock types were instances of objects, e.g.
> navigator.*Lock objects could be instances of a variant of the WakeLock
> interface:
> 
> navigator.screenLock.request();
> navigator.screenLock.isHeld();
> 
> navigator.cpuLock.request();
> navigator.cpuLock.release();

I think the problem of feature detection is fair. Though, I think a
pattern like navigator.wakeLock.${name}.request(); would be conveniently
namespace'd. You would have .request, .release() and .held() (or.has())
I guess.

-- Mounir

Received on Tuesday, 19 August 2014 12:12:17 UTC