fix: prevent create multiple wake lock

This commit is contained in:
YSH 2024-06-11 18:14:32 -07:00
parent 1f8f3a6e8b
commit c803e11505
1 changed files with 1 additions and 1 deletions

View File

@ -79,7 +79,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var wakeLock = null; var wakeLock = null;
var requestWakeLock = async function() { var requestWakeLock = async function() {
if (!opts.prevent_screen_sleep_during_generation) return; if (!opts.prevent_screen_sleep_during_generation || wakeLock) return;
try { try {
wakeLock = await navigator.wakeLock.request('screen'); wakeLock = await navigator.wakeLock.request('screen');
console.log('Wake Lock is active.'); console.log('Wake Lock is active.');