From fe5c1fa785dddf2ba93a62c430db3de5951ee469 Mon Sep 17 00:00:00 2001 From: Salzian Date: Wed, 8 May 2024 23:47:50 +0200 Subject: [PATCH] Parallelized initial settings loading --- BlueMapCommon/webapp/src/js/BlueMapApp.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BlueMapCommon/webapp/src/js/BlueMapApp.js b/BlueMapCommon/webapp/src/js/BlueMapApp.js index 85370874..dc0ba1aa 100644 --- a/BlueMapCommon/webapp/src/js/BlueMapApp.js +++ b/BlueMapCommon/webapp/src/js/BlueMapApp.js @@ -299,15 +299,17 @@ export class BlueMapApp { // create maps if (settings.maps !== undefined){ - for (let mapId of settings.maps) { + let loadingPromises = settings.maps.map(mapId => { let map = new BlueMapMap(mapId, this.dataUrl + mapId + "/", this.loadBlocker, this.mapViewer.events); maps.push(map); - await map.loadSettings(this.mapViewer.tileCacheHash) + return map.loadSettings(this.mapViewer.tileCacheHash) .catch(error => { alert(this.events, `Failed to load settings for map '${map.data.id}':` + error, "warning"); }); - } + }) + + await Promise.all(loadingPromises); } // sort maps