1 Matching Annotations
- Feb 2022
-
developer.mozilla.org developer.mozilla.org
-
Reacquiring a wake lock
The following code reacquires the wake lock should the visibility of the document change and the wake lock is released.
js document.addEventListener('visibilitychange', async () => { if (wakeLock !== null && document.visibilityState === 'visible') { wakeLock = await navigator.wakeLock.request('screen'); } });
-