Przeglądaj źródła

fix: add progress bar fix

KernelDeimos 7 miesięcy temu
rodzic
commit
a70d0dd088
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      src/emulator/src/main.js

+ 3 - 1
src/emulator/src/main.js

@@ -221,6 +221,7 @@ window.onload = async function()
     const total = parseInt(contentLength, 10);
     const reader = resp.body.getReader();
     let downloaded = 0;
+    let downloadedForProgress = 0;
 
     const brotli = await brotliCJS.default;
     const decompStream = new brotli.DecompressStream();
@@ -248,9 +249,10 @@ window.onload = async function()
         if ( failed ) {
             throw new Error('decompression failed', resultCode);
         }
+        downloadedForProgress += value.byteLength;
         // uint8arrays.push(value);
         // downloaded += value.byteLength;
-        // status.phase_progress = downloaded / total;
+        status.phase_progress = downloadedForProgress / total;
     }
     // const arrayBuffer = await resp.arrayBuffer();