From ee0ad5cceb72f57954f5dcb4774b92e7d1ad7f8e Mon Sep 17 00:00:00 2001 From: bluelovers Date: Fri, 25 Oct 2024 09:59:45 +0800 Subject: [PATCH] chore(js): avoid lots of `Wake Lock is not supported.` --- javascript/progressbar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/javascript/progressbar.js b/javascript/progressbar.js index 23dea64ce..c81a41e9a 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -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; } };