aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorandre-dietrich <dietrich@ivs.cs.uni-magdeburg.de>2019-08-09 14:38:04 +0200
committerAndré Dietrich <andre.dietrich@ovgu.de>2019-09-06 13:39:55 +0200
commit5e78c8d4bd8527d2b0cd38022ab414eb9545e6d5 (patch)
treee6df793be63e11fb37d9212857bf62a504b0863e /src
parenta993703ad736c14e36e374c91aed4663f1841234 (diff)
fixing error "style is not done loading"
a little modification according to the following suggestion : https://bl.ocks.org/malwoodsantoro/43bba1d03a8d22c10b3e9943eb0c55d1
Diffstat (limited to 'src')
-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;
}