Skip to content

Commit

Permalink
Merge pull request #16588 from bluelovers/patch-3
Browse files Browse the repository at this point in the history
chore(js): avoid lots of `Wake Lock is not supported.`
  • Loading branch information
w-e-w authored Oct 27, 2024
2 parents 38c8043 + ee0ad5c commit d88a3c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion javascript/progressbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down

0 comments on commit d88a3c1

Please sign in to comment.