Open utterances-bot opened 2 years ago
I am presuming this allows multiple locks to be generated? Since the unlock is on the request object?
So may be bad if someone calls wakeLoclState()
twice.
Unless it returns the same object every time request is called?
I will test next time I am on my work machine
I am presuming this allows multiple locks to be generated? Since the unlock is on the request object? So may be bad if someone calls
wakeLoclState()
twice. Unless it returns the same object every time request is called? I will test next time I am on my work machine
navigator.wakeLock.request()
only creates a new wake lock request, and can fail for a number of reasons (eg. the tab is not active). further requests will override the old request. While for efficiency sake, you don't want to make a bunch of calls to lockWakeState
. It will only ever create a single wake lock.
Thanks for posting this! Your example is well thought out 🙂 Excited to see support in Safari and Firefox in the future; I've never seen the caniuse.com widget embedded in a blog before, was nice to have it inline for reference.
Thanks for posting this! Your example is well thought out 🙂 Excited to see support in Safari and Firefox in the future; I've never seen the caniuse.com widget embedded in a blog before, was nice to have it inline for reference.
The can I use embed isn't actually official. You can find it here. Sorry it took me so long to reply, I honestly thought I already had...
I'm so glad you enjoyed the article.
Thanks a lot for the article!! Really straightforward.
Stop The Screen Going To Sleep With JavaScript | Michael Walter Van Der Velden
We've all been there. Cooking a complex recipe where each step takes a good couple of minutes. Our hands covered in some type of sauce made of who knows how many ingredients. We go to check the next step on our phone only to see that it's gone to sleep due to inactivity. We know that even if we quickly wash our hands, there is inevitably going to be some level of greasy trail left on our phone screen as we are forced to unlock it...
https://mikevdv.dev/blog/2022-06-23-stop-the-screen-going-to-sleep-with-javascript