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 previousReadingTime = null;
let screenLock; let screenLock;
navigator.wakeLock.request('screen') document.addEventListener('visibilitychange', async () => {
.then(lock => { if (screenLock !== null && document.visibilityState === 'visible') {
screenLock = lock; screenLock = await navigator.wakeLock.request('screen');
}
}); });
const integerNumber = (num) => parseInt(num); const integerNumber = (num) => parseInt(num);