Last active
August 18, 2021 15:06
-
-
Save nomomon/5f9b0c65531ac6ce0a25c301aef76288 to your computer and use it in GitHub Desktop.
Bookmarklet to prevent screen from sleeping on a webpage. An alert message is send when the wake lock is released (tab was changed; browser not in focus).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
wakeLock = await navigator.wakeLock.request('screen'); | |
wakeLock.addEventListener('release', (e) => { | |
alert("Wake lock released"); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this a bookmarklet follow this tutorial.