feat: load all datalayers in parallel

This commit is contained in:
Yohan Boniface 2024-12-16 18:03:45 +01:00
parent fe06a0ff8e
commit e3f02a475f

View file

@ -570,9 +570,11 @@ export default class Umap extends ServerStored {
} }
this.datalayersLoaded = true this.datalayersLoaded = true
this.fire('datalayersloaded') this.fire('datalayersloaded')
const toLoad = []
for (const datalayer of this.datalayersIndex) { for (const datalayer of this.datalayersIndex) {
if (datalayer.showAtLoad()) await datalayer.show() if (datalayer.showAtLoad()) toLoad.push(datalayer.show())
} }
await Promise.all(toLoad)
this.dataloaded = true this.dataloaded = true
this.fire('dataloaded') this.fire('dataloaded')
} }