Merge pull request #16588 from bluelovers/patch-3
Some checks failed
Linter / ruff (push) Has been cancelled
Linter / eslint (push) Has been cancelled
Tests / tests on CPU with empty model (push) Has been cancelled

chore(js): avoid lots of `Wake Lock is not supported.`
This commit is contained in:
w-e-w
2024-10-27 10:28:23 +09:00
committed by GitHub

View File

@@ -79,11 +79,12 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var wakeLock = null;
var requestWakeLock = async function() {
if (!opts.prevent_screen_sleep_during_generation || wakeLock) return;
if (!opts.prevent_screen_sleep_during_generation || wakeLock !== null) return;
try {
wakeLock = await navigator.wakeLock.request('screen');
} catch (err) {
console.error('Wake Lock is not supported.');
wakeLock = false;
}
};