- From: Kenneth Rohde Christiansen via GitHub <sysbot+gh@w3.org>
- Date: Tue, 24 Sep 2019 08:56:25 +0000
- To: public-device-apis-log@w3.org
> ```js
> let lock = await navigator.wakeLock.request("screen");
> lock.onstatechange = async ev => {
> // request a new lock, maybe...
> lock = await navigator.wakeLock.request(ev.lock.type);
> }
> ```
So when the promise resolves it will have either failed or be active, but before you add the `onstatechanged` callback. That makes `onstatechanged` a bit useless, and we might as well just have a `onlockreleased` instead.
Also, can you try writing your example in a way where it integrates with visibilitychange?
--
GitHub Notification of comment by kenchris
Please view or discuss this issue at https://github.com/w3c/wake-lock/issues/226#issuecomment-534462642 using your GitHub account
Received on Tuesday, 24 September 2019 08:56:27 UTC