From 355188431e68af1f956faf7dafb9f478ae7f7a67 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 17 Oct 2021 11:58:48 -0500 Subject: [PATCH] Fix a couple small progress bar bugs with inline project data --- src/packager/packager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/packager/packager.js b/src/packager/packager.js index 572665d..a8b2524 100644 --- a/src/packager/packager.js +++ b/src/packager/packager.js @@ -665,13 +665,13 @@ if (acquiredLock) { async generateGetProjectData () { if (this.options.target === 'html') { const SEGMENT_LENGTH = 100000; - const data = await readAsArrayBuffer(this.project.blob); - const encoded = encode(data); + const arrayBuffer = await readAsArrayBuffer(this.project.blob); + const encoded = encode(arrayBuffer); let result = ''; for (let i = 0; i < encoded.length; i += SEGMENT_LENGTH) { const segment = encoded.substr(i, SEGMENT_LENGTH); - const progress = PROGRESS_LOADED_SCRIPTS + PROGRESS_FETCHED_INLINE_DATA_BUT_NOT_LOADED * (i / encoded.length); - // Progress will always be a number between 0 and 1. We can remove the leading "0" and unnecessary decimals to save space. + const progress = PROGRESS_LOADED_SCRIPTS + (PROGRESS_FETCHED_INLINE_DATA_BUT_NOT_LOADED - PROGRESS_LOADED_SCRIPTS) * (i / encoded.length); + // Progress will always be a number between 0 and 1. We can remove the leading 0 and unnecessary decimals to save space. const shortenedProgress = progress.toString().substr(1, 4); result += ``; }