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