diff --git a/src/app/utils.ts b/src/app/utils.ts index c371a17..ea5da2b 100644 --- a/src/app/utils.ts +++ b/src/app/utils.ts @@ -54,7 +54,7 @@ export let bccReady = new Promise((resolve, reject) => { */ const percentageThreshold = 100 / 9; let lastPercentage = 0; -let waitForLoadingAnimation; +let waitForLoadingAnimation = Promise.resolve(); let percentagesSet = [ ]; /** @@ -148,14 +148,14 @@ export function showError() { * @return {string} additional returnObject */ export async function raiseProgress(percentage: number, returnObj?: any) { + // wait for last animation to be finished + await this.waitForLoadingAnimation; + lastPercentage += percentage; if (lastPercentage > 100) { lastPercentage = 100; } - // wait for last animation to be finished - await this.waitForLoadingAnimation; - // set the percentage only, if it wasn't set before if (!percentagesSet[lastPercentage]) { percentagesSet[lastPercentage] = true;