Skip to content

Commit

Permalink
chore(js): avoid lots of Wake Lock is not supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers authored Oct 25, 2024
1 parent 984b952 commit ee0ad5c
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 ee0ad5c

Please sign in to comment.