feat: load all datalayers in parallel (#2370)

This commit is contained in:
Yohan Boniface 2024-12-16 18:26:55 +01:00 committed by GitHub
commit b92490eacc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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')
} }