- From: Kornel Lesiński <kornel@geekhood.net>
- Date: Mon, 18 Aug 2014 23:41:29 +0100
- To: WHAT Working Group <whatwg@lists.whatwg.org>
- Cc: Marcos Caceres <w3c@marcosc.com>
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(); Alternatively, if the WakeLock was instantiable (to have a standard way for independent page components to share locks) then these objects could be constructors: if (navigator.ScreenLock) { var lock = new navigator.ScreenLock(); … lock.release(); } (or `new navigator.wakeLocks.Screen()`, etc.) Having specific instances for different types of locks could also enable elegant extensibility of the API, e.g. var screenLock = new navigator.ScreenLock(); screenLock.dimScreen(); // completely made-up API var cpuLock = new navigator.CpuLock(); cpuLock.setThreadPriority("low"); // completely made-up API -- regards, Kornel
Received on Monday, 18 August 2014 22:42:02 UTC