mobility-toolbox-js 3.0.0-beta.28 → 3.0.0-beta.29

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.
@@ -117,7 +117,7 @@ declare function PropertiesLayerMixin<TBase extends Layerable>(Base: TBase): {
117
117
  hasProperties: () => boolean;
118
118
  notify: (key: string, oldValue: any) => void;
119
119
  addChangeListener: (key: string, listener: import("ol/events").Listener) => void;
120
- removeChangeListener: (key: string, listener: import("ol/events").Listener) => void;
120
+ removeChangeListener: (key: string, listener: import("ol/events" /** @deprecated */).Listener) => void;
121
121
  set: (key: string, value: any, silent?: boolean | undefined) => void;
122
122
  setProperties: (values: {
123
123
  [x: string]: any;
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line max-classes-per-file
2
2
  import debounce from 'lodash.debounce';
3
3
  import { getUid } from 'ol';
4
+ import { unByKey } from 'ol/Observable';
4
5
  import getLayersAsFlatArray from '../../common/utils/getLayersAsFlatArray';
5
6
  let deprecated = () => { };
6
7
  if (typeof window !== 'undefined' &&
@@ -16,7 +17,6 @@ if (typeof window !== 'undefined' &&
16
17
  function PropertiesLayerMixin(Base) {
17
18
  return class PropertiesLayer extends Base {
18
19
  constructor(...args) {
19
- var _a;
20
20
  const options = args[0];
21
21
  super(options);
22
22
  this.olEventsKeys = [];
@@ -25,13 +25,12 @@ function PropertiesLayerMixin(Base) {
25
25
  deprecated("Deprecated. Don't use properties options. Pass the values directly in options object.");
26
26
  this.setProperties(options.properties);
27
27
  }
28
- (_a = this.olEventsKeys) === null || _a === void 0 ? void 0 : _a.push(
29
28
  // Update parent property
30
29
  this.on('propertychange', (evt) => {
31
30
  if (evt.key === 'children') {
32
31
  this.onChildrenChange(evt.oldValue);
33
32
  }
34
- }));
33
+ });
35
34
  this.options = options;
36
35
  this.set('children', options.children || []); // Trigger the on children change event
37
36
  }
@@ -51,6 +50,7 @@ function PropertiesLayerMixin(Base) {
51
50
  * Terminate what was initialized in init function. Remove layer, events...
52
51
  */
53
52
  detachFromMap() {
53
+ unByKey(this.olEventsKeys);
54
54
  (this.get('children') || []).forEach((child) => {
55
55
  this.map.removeLayer(child);
56
56
  });
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.28",
5
+ "version": "3.0.0-beta.29",
6
6
  "homepage": "https://mobility-toolbox-js.geops.io/",
7
7
  "exports": {
8
8
  ".": "./index.js",