mobility-toolbox-js 3.0.0-beta.2 → 3.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -185,13 +185,12 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
185
185
  /** @private */
186
186
  addSources() {
187
187
  var _a;
188
- if (!((_a = this.maplibreLayer) === null || _a === void 0 ? void 0 : _a.maplibreMap) || !Array.isArray(this.sources)) {
188
+ if (!((_a = this.maplibreLayer) === null || _a === void 0 ? void 0 : _a.maplibreMap) || !this.sources) {
189
189
  return;
190
190
  }
191
191
  const { maplibreMap } = this.maplibreLayer;
192
192
  if (maplibreMap) {
193
- this.sources.forEach((source) => {
194
- const { id } = source;
193
+ Object.entries(this.sources).forEach(([id, source]) => {
195
194
  if (!maplibreMap.getSource(id)) {
196
195
  maplibreMap.addSource(id, source);
197
196
  }
@@ -201,13 +200,12 @@ class MaplibreStyleLayer extends MobilityLayerMixin(Layer) {
201
200
  /** @private */
202
201
  removeSources() {
203
202
  var _a;
204
- if (!((_a = this.maplibreLayer) === null || _a === void 0 ? void 0 : _a.maplibreMap) || !Array.isArray(this.layers)) {
203
+ if (!((_a = this.maplibreLayer) === null || _a === void 0 ? void 0 : _a.maplibreMap) || !this.sources) {
205
204
  return;
206
205
  }
207
206
  const { maplibreMap } = this.maplibreLayer;
208
207
  if (maplibreMap) {
209
- this.sources.forEach((source) => {
210
- const { id } = source;
208
+ Object.keys(this.sources).forEach((id) => {
211
209
  if (maplibreMap.getSource(id)) {
212
210
  maplibreMap.removeSource(id);
213
211
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mobility-toolbox-js",
3
3
  "license": "MIT",
4
4
  "description": "Toolbox for JavaScript applications in the domains of mobility and logistics.",
5
- "version": "3.0.0-beta.2",
5
+ "version": "3.0.0-beta.3",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "module": "index.js",
8
8
  "exports": {