Fix issue where screen would eventually turn off if you switched apps and then came back
This commit is contained in:
@@ -109,10 +109,11 @@
|
||||
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);
|
||||
const decimalNumber = (num) => parseFloat(num.toFixed(1));
|
||||
|
||||
Reference in New Issue
Block a user