Re: [wake-lock] WakeLock.request() returns a promise that never resolves (#226)

> ```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 using your GitHub account

Received on Tuesday, 24 September 2019 08:56:27 UTC