mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 02:53:09 +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 (defaultStore.state.keepScreenOn) {
|
||||||
if ('wakeLock' in navigator) {
|
if ('wakeLock' in navigator) {
|
||||||
navigator.wakeLock.request('screen');
|
try {
|
||||||
|
navigator.wakeLock.request('screen');
|
||||||
|
} catch (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', async () => {
|
document.addEventListener('visibilitychange', async () => {
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
navigator.wakeLock.request('screen');
|
try {
|
||||||
|
navigator.wakeLock.request('screen');
|
||||||
|
} catch (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue