diff --git a/docs/index.html b/docs/index.html index 9d406c0..26a49e2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -296,11 +296,10 @@

Online Converter

const arrayBuffer = await file.arrayBuffer(); const sourceBytes = new Uint8Array(arrayBuffer); - // Await a Promise that resolves when the setTimeout for this image finishes - await new Promise((resolve) => { - setTimeout(() => { - try { - ImageMagick.read(sourceBytes, (image) => { + // Await a short tick to allow the UI to update between images + await new Promise(r => setTimeout(r, 0)); + try { + ImageMagick.read(sourceBytes, (image) => { if (targetExt === 'jpg' || targetExt === 'jpeg') { image.hasAlpha = false; } @@ -333,14 +332,11 @@

Online Converter

} successCount++; }); - }); - } catch(err) { - console.error(`Error processing ${file.name}:`, err); - failCount++; - } - resolve(); - }, 50); - }); + }); + } catch(err) { + console.error(`Error processing ${file.name}:`, err); + failCount++; + } } catch (err) { console.error(`Error reading ${file.name}:`, err); failCount++;