diff --git a/index.html b/index.html index ff74875..24a0274 100644 --- a/index.html +++ b/index.html @@ -615,6 +615,10 @@
+const checkbox = document.createElement("input"); checkbox.setAttribute("type", "checkbox"); document.body.appendChild(checkbox); - navigator.wakeLock.request("screen").then(lock => { - checkbox.checked = true; - - const listener = (ev) => { - checkbox.checked = false; - ev.target.removeEventListener('release', listener); - }; - - lock.addEventListener('release', listener); - }); + const sentinel = await navigator.wakeLock.request("screen"); + checkbox.checked = true; + sentinel.onrelease = () => checkbox.checked = false;In this example, two different wake lock requests are created and