Re: [wake-lock] Add example usage of onrelease event. (#250)

First, I apologize having overlooked that there was an example.  I looked adjacent to the release event definition, and searched the page for 'onrelease', and didn't take the time to find example 2.

I do like the rework.  Using 'onrelease' will help others who make my mistake.  As would having the example linked or moved to be in context.  

Also, might keep it even simpler by directly assigning the function and not de-registering it.  Focusing just on what's needed to demonstrate the spec:

```
const sentinel = await navigator.wakeLock.request('screen');
checkbox.checked = true;

sentinel.onrelease = () => checkbox.checked = false;
``` 

Are there any other things we expect apps to do when lock is lost?  Attempt to reacquire?  That's blocked because user activation is needed.  Any other possible action other than just notifying the user in UI that lock is lost?

-- 
GitHub Notification of comment by scheib
Please view or discuss this issue at https://github.com/w3c/wake-lock/issues/250#issuecomment-582029881 using your GitHub account

Received on Tuesday, 4 February 2020 17:43:04 UTC