aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/main.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/js/main.js b/src/js/main.js
index e5112fb..61054cc 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -255,12 +255,16 @@ export function registerCustomElement(settings) {
this._eventRegistrationQueue = {};
options.onMount(this._map, this);
if (commandRegistry[this.id]) {
- this._map.on("load", () => {
- var cmd;
- while ((cmd = commandRegistry[this.id].shift())) {
- cmd(this._map);
- }
- });
+ function onStyleData(){
+ if(map.isStyleLoaded()) {
+ var cmd;
+ while ((cmd = commandRegistry[this.id].shift())) {
+ cmd(this._map);
+ }
+ map.off('data', onStyleData)
+ }
+ };
+ this._map.on("data", onStyleData);
}
return this._map;
}