Implement error method for gallery progress

Handle instances when Web Crypto API is not available.
This commit is contained in:
awsr
2026-02-12 03:16:07 -08:00
parent 63c5e493be
commit 6971f3438c
+10
View File
@@ -223,6 +223,15 @@ class SimpleProgressBar {
this.#text.textContent = '';
}
error(message) {
this.#stop();
clearTimeout(this.#hideTimeout);
this.#text.textContent = message;
this.#hideTimeout = setTimeout(() => {
this.clear();
}, 2000);
}
#update(loaded, max) {
if (this.#hideTimeout) {
this.#hideTimeout = null;
@@ -655,6 +664,7 @@ async function getHash(str) {
return hex;
} catch (err) {
error('getHash:', err);
galleryProgressBar.error('File hash error');
return undefined;
}
}