mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-22 22:33:08 +02:00
fix: wakelock error causing site to not load
This commit is contained in:
parent
83be996a3d
commit
7c922dc39b
1 changed files with 10 additions and 2 deletions
|
@ -204,11 +204,19 @@ export async function common(createVue: () => App<Element>) {
|
|||
|
||||
if (defaultStore.state.keepScreenOn) {
|
||||
if ('wakeLock' in navigator) {
|
||||
navigator.wakeLock.request('screen');
|
||||
try {
|
||||
navigator.wakeLock.request('screen');
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.addEventListener('visibilitychange', async () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
navigator.wakeLock.request('screen');
|
||||
try {
|
||||
navigator.wakeLock.request('screen');
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue