Merge pull request #1122 from jacobtoye/LayerGroupEvents

Added 'layeradd' and 'layerremove' events to LayerGroup.
This commit is contained in:
Vladimir Agafonkin 2012-11-06 00:37:40 -08:00
commit 85ed21539f

View File

@ -24,6 +24,8 @@ L.LayerGroup = L.Class.extend({
this._map.addLayer(layer); this._map.addLayer(layer);
} }
this.fire('layeradd', { layer: layer });
return this; return this;
}, },
@ -36,6 +38,8 @@ L.LayerGroup = L.Class.extend({
this._map.removeLayer(layer); this._map.removeLayer(layer);
} }
this.fire('layerremove', { layer: layer });
return this; return this;
}, },