Skip to content

Commit bb0148d

Browse files
author
Nicolò Maria Mezzopera
committed
feat: add ready event to all components
1 parent 8dda7ce commit bb0148d

23 files changed

+24
-0
lines changed

src/components/LCircle.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
this.ready = true;
3232
this.parentContainer = findRealParent(this.$parent);
3333
this.parentContainer.addLayer(this, !this.visible);
34+
this.$emit('ready', this.mapObject);
3435
},
3536
methods: {}
3637
};

src/components/LCircleMarker.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default {
3535
this.ready = true;
3636
this.parentContainer = findRealParent(this.$parent);
3737
this.parentContainer.addLayer(this, !this.visible);
38+
this.$emit('ready', this.mapObject);
3839
}
3940
};
4041
</script>

src/components/LControl.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
this.parentContainer = findRealParent(this.$parent);
3030
this.mapObject.setElement(this.$el);
3131
this.mapObject.addTo(this.parentContainer.mapObject);
32+
this.$emit('ready', this.mapObject);
3233
}
3334
};
3435
</script>

src/components/LControlAttribution.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121
this.mapObject = control.attribution(options);
2222
propsBinder(this, this.mapObject, this.$options.props);
2323
this.mapObject.addTo(this.$parent.mapObject);
24+
this.$emit('ready', this.mapObject);
2425
},
2526
render () {
2627
return null;

src/components/LControlLayers.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default {
4141
this.mapObject = control.layers(null, null, options);
4242
propsBinder(this, this.mapObject, this.$options.props);
4343
this.$parent.registerLayerControl(this);
44+
this.$emit('ready', this.mapObject);
4445
},
4546
methods: {
4647
addLayer (layer) {

src/components/LControlScale.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
this.mapObject = control.scale(options);
3737
propsBinder(this, this.mapObject, this.$options.props);
3838
this.mapObject.addTo(this.$parent.mapObject);
39+
this.$emit('ready', this.mapObject);
3940
},
4041
render () {
4142
return null;

src/components/LControlZoom.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
this.mapObject = control.zoom(options);
3737
propsBinder(this, this.mapObject, this.$options.props);
3838
this.mapObject.addTo(this.$parent.mapObject);
39+
this.$emit('ready', this.mapObject);
3940
},
4041
render () {
4142
return null;

src/components/LFeatureGroup.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default {
2626
if (this.visible) {
2727
this.parentContainer.addLayer(this);
2828
}
29+
this.$emit('ready', this.mapObject);
2930
}
3031
};
3132
</script>

src/components/LGeoJson.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default {
3737
propsBinder(this, this.mapObject, this.$options.props);
3838
this.parentContainer = findRealParent(this.$parent, true);
3939
this.parentContainer.addLayer(this, !this.visible);
40+
this.$emit('ready', this.mapObject);
4041
},
4142
beforeDestroy () {
4243
this.parentContainer.mapObject.removeLayer(this.mapObject);

src/components/LGridLayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default {
4343
this.mapObject.createTile = this.createTile;
4444
this.parentContainer = findRealParent(this.$parent);
4545
this.parentContainer.addLayer(this, !this.visible);
46+
this.$emit('ready', this.mapObject);
4647
},
4748
beforeDestroy () {
4849
this.parentContainer.removeLayer(this.mapObject);

src/components/LIcon.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default {
101101
);
102102
103103
this.scheduleCreateIcon();
104+
this.$emit('ready', this.mapObject);
104105
},
105106
106107
beforeDestroy () {

src/components/LIconDefault.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414
mounted () {
1515
Icon.Default.imagePath = this.imagePath;
1616
propsBinder(this, this.mapObject, this.$options.props);
17+
this.$emit('ready', this.mapObject);
1718
},
1819
methods: {
1920
setImagePath (newVal, oldVal) {

src/components/LImageOverlay.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default {
1313
propsBinder(this, this.mapObject, this.$options.props);
1414
this.parentContainer = findRealParent(this.$parent);
1515
this.parentContainer.addLayer(this, !this.visible);
16+
this.$emit('ready', this.mapObject);
1617
},
1718
render () {
1819
return null;

src/components/LLayerGroup.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default {
2626
if (this.visible) {
2727
this.parentContainer.addLayer(this);
2828
}
29+
this.$emit('ready', this.mapObject);
2930
}
3031
};
3132
</script>

src/components/LMap.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ export default {
156156
DomEvent.on(this.mapObject, this.$listeners);
157157
propsBinder(this, this.mapObject, this.$options.props);
158158
this.ready = true;
159+
// DEPRECATED leaflet:load
159160
this.$emit('leaflet:load');
161+
this.$emit('ready', this.mapObject);
160162
},
161163
methods: {
162164
registerLayerControl (lControlLayers) {

src/components/LMarker.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default {
5252
this.parentContainer = findRealParent(this.$parent);
5353
this.parentContainer.addLayer(this, !this.visible);
5454
this.ready = true;
55+
this.$emit('ready', this.mapObject);
5556
},
5657
methods: {
5758
setDraggable (newVal, oldVal) {

src/components/LPolygon.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
this.ready = true;
3232
this.parentContainer = findRealParent(this.$parent);
3333
this.parentContainer.addLayer(this, !this.visible);
34+
this.$emit('ready', this.mapObject);
3435
}
3536
};
3637
</script>

src/components/LPolyline.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
this.ready = true;
3232
this.parentContainer = findRealParent(this.$parent);
3333
this.parentContainer.addLayer(this, !this.visible);
34+
this.$emit('ready', this.mapObject);
3435
}
3536
};
3637
</script>

src/components/LPopup.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
this.mapObject.setContent(this.content || this.$el);
2525
this.parentContainer = findRealParent(this.$parent);
2626
this.parentContainer.mapObject.bindPopup(this.mapObject);
27+
this.$emit('ready', this.mapObject);
2728
},
2829
beforeDestroy () {
2930
if (this.parentContainer) {

src/components/LRectangle.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
this.ready = true;
3232
this.parentContainer = findRealParent(this.$parent);
3333
this.parentContainer.addLayer(this, !this.visible);
34+
this.$emit('ready', this.mapObject);
3435
}
3536
};
3637
</script>

src/components/LTileLayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
propsBinder(this, this.mapObject, this.$options.props);
2929
this.parentContainer = findRealParent(this.$parent);
3030
this.parentContainer.addLayer(this, !this.visible);
31+
this.$emit('ready', this.mapObject);
3132
}
3233
};
3334
</script>

src/components/LTooltip.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default {
1515
this.mapObject.setContent(this.content || this.$el);
1616
this.parentContainer = findRealParent(this.$parent);
1717
this.parentContainer.mapObject.bindTooltip(this.mapObject);
18+
this.$emit('ready', this.mapObject);
1819
},
1920
beforeDestroy () {
2021
if (this.parentContainer) {

src/components/LWMSTileLayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
propsBinder(this, this.mapObject, this.$options.props);
2121
this.parentContainer = findRealParent(this.$parent);
2222
this.parentContainer.addLayer(this, !this.visible);
23+
this.$emit('ready', this.mapObject);
2324
}
2425
};
2526
</script>

0 commit comments

Comments
 (0)