Skip to content

Commit 4003d4f

Browse files
committed
chore: Adjust progress
1 parent 6ad8917 commit 4003d4f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ namespace Uno.WebAssembly.Bootstrap {
3434
private _isUsingCommonJS: boolean;
3535
private _currentBrowserIsChrome: boolean;
3636
private _hasReferencedPdbs: boolean;
37+
private _previousTotalResources: number;
38+
private _currentTargetProgress: number;
3739

3840
static ENVIRONMENT_IS_WEB: boolean;
3941
static ENVIRONMENT_IS_WORKER: boolean;
@@ -278,11 +280,18 @@ namespace Uno.WebAssembly.Bootstrap {
278280
}
279281

280282
private reportDownloadResourceProgress(resourcesLoaded: number, totalResources: number) {
283+
this.progress.max = 100;
284+
281285
// The totalResources value reported by .NET does not represent
282286
// the actual total. To prevent progress bar from jumping
283287
// setting the max progress to 100 instead.
284-
this.progress.max = 100;
285-
(<any>this.progress).value = Math.min(resourcesLoaded, 100);
288+
if (_previousTotalResources != totalResources)
289+
{
290+
_currentTargetProgress = (100 - _currentTargetProgress) / 2;
291+
_previousTotalResources = totalResources;
292+
}
293+
294+
(<any>this.progress).value = Math.min(resourcesLoaded, _currentTargetProgress);
286295
}
287296

288297
private initProgress() {

0 commit comments

Comments
 (0)