Fix issue where screen would eventually turn off if you switched apps and then came back

This commit is contained in:
Peter Stockings
2023-03-25 20:25:22 +11:00
parent b06c6281b4
commit 7021ee14cf

View File

@@ -109,9 +109,10 @@
let previousReadingTime = null;
let screenLock;
navigator.wakeLock.request('screen')
.then(lock => {
screenLock = lock;
document.addEventListener('visibilitychange', async () => {
if (screenLock !== null && document.visibilityState === 'visible') {
screenLock = await navigator.wakeLock.request('screen');
}
});
const integerNumber = (num) => parseInt(num);