From cf599643f436cdbe7f068d01ab456dce2a79bf3a Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio@bekerle.com> Date: Fri, 3 Apr 2020 10:01:09 +0200 Subject: [PATCH] Did async foreach refactoring --- packages/file-handling/src/vpu-fileupload.js | 8 +------- packages/file-handling/vendor/common | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/file-handling/src/vpu-fileupload.js b/packages/file-handling/src/vpu-fileupload.js index 7f387b54..05ac18c0 100644 --- a/packages/file-handling/src/vpu-fileupload.js +++ b/packages/file-handling/src/vpu-fileupload.js @@ -108,12 +108,6 @@ class VPUFileUpload extends VPULitElement { fileElem.value = ''; } - async asyncForEach(array, callback) { - for (let index = 0; index < array.length; index++) { - await callback(array[index], index, array); - } - } - async handleFiles(files) { console.log('handleFiles: files.length = ' + files.length); @@ -121,7 +115,7 @@ class VPUFileUpload extends VPULitElement { { "detail": {}, bubbles: true, composed: true })); // we need to wait for each upload until we start the next one - await this.asyncForEach(files, async (file) => this.uploadFile(file)); + await commonUtils.asyncArrayForEach(files, async (file) => this.uploadFile(file)); this.dispatchEvent(new CustomEvent("vpu-fileupload-all-finished", { "detail": {}, bubbles: true, composed: true })); diff --git a/packages/file-handling/vendor/common b/packages/file-handling/vendor/common index 5aa64ec4..4f1d5c50 160000 --- a/packages/file-handling/vendor/common +++ b/packages/file-handling/vendor/common @@ -1 +1 @@ -Subproject commit 5aa64ec47e7b65d69327f4dec1102917fe33bd22 +Subproject commit 4f1d5c504ad5935b8903ab37abcbaa2b588112bd -- GitLab