@wemap/providers 9.0.0-alpha.2 → 9.0.0-alpha.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.
package/package.json CHANGED
@@ -9,13 +9,13 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "@wemap/camera": "^9.0.0-alpha.1",
12
- "@wemap/geo": "^9.0.0-alpha.2",
12
+ "@wemap/geo": "^9.0.0-alpha.3",
13
13
  "@wemap/geomagnetism": "^0.1.1",
14
14
  "@wemap/logger": "^9.0.0-alpha.1",
15
- "@wemap/map": "^9.0.0-alpha.2",
15
+ "@wemap/map": "^9.0.0-alpha.3",
16
16
  "@wemap/maths": "^8.1.0",
17
- "@wemap/osm": "^9.0.0-alpha.2",
18
- "@wemap/routers": "^9.0.0-alpha.2",
17
+ "@wemap/osm": "^9.0.0-alpha.3",
18
+ "@wemap/routers": "^9.0.0-alpha.3",
19
19
  "@wemap/utils": "^8.1.0"
20
20
  },
21
21
  "description": "A package using different geoloc systems",
@@ -42,6 +42,6 @@
42
42
  "url": "git+https://github.com/wemap/wemap-modules-js.git"
43
43
  },
44
44
  "type": "module",
45
- "version": "9.0.0-alpha.2",
46
- "gitHead": "7e0bc6a37e0a3a83b5b2f697cc000328f79c484a"
45
+ "version": "9.0.0-alpha.3",
46
+ "gitHead": "b51ee342c82a98b401288195148d5293662212b7"
47
47
  }
@@ -16,6 +16,7 @@ const ProvidersOptions = {
16
16
  * require data from an optional external service or because they drain more
17
17
  * battery. They can be added to this list to be used
18
18
  * List of {@link Provider#pname}
19
+ * @type {string[]}
19
20
  */
20
21
  optionalProviders: [],
21
22
 
@@ -35,6 +36,10 @@ const ProvidersOptions = {
35
36
 
36
37
  get hasVps() {
37
38
  return this.optionalProviders.includes('Vps');
39
+ },
40
+
41
+ get hasPoleStar() {
42
+ return this.optionalProviders.includes('PoleStar');
38
43
  }
39
44
  };
40
45
 
@@ -10,6 +10,7 @@ import { default as GeoRelativePositionProvider } from '../relative/GeoRelativeP
10
10
  import ProvidersOptions from '../../../ProvidersOptions.js';
11
11
  import ProviderState from '../../ProviderState.js';
12
12
  import Vps from '../../vision/Vps.js';
13
+ import PoleStar from './PoleStar.js';
13
14
 
14
15
  class AbsolutePosition extends Provider {
15
16
 
@@ -91,6 +92,14 @@ class AbsolutePosition extends Provider {
91
92
 
92
93
  }
93
94
 
95
+ if (ProvidersOptions.hasPoleStar) {
96
+ this._polestarProviderId = PoleStar.addEventListener(events => {
97
+ this._onAbsolutePosition(events.find(event => event.dataType === EventType.AbsolutePosition));
98
+ PoleStar.removeEventListener(this._polestarProviderId);
99
+ this._polestarProviderId = null;
100
+ });
101
+ }
102
+
94
103
  this._mapMatchingHandlerId = MapMatchingHandler.addEventListener();
95
104
  }
96
105
 
@@ -111,6 +120,10 @@ class AbsolutePosition extends Provider {
111
120
  Vps.removeEventListener(this._vpsProviderId);
112
121
  this._vpsProviderId = null;
113
122
  }
123
+ if (this._polestarProviderId) {
124
+ PoleStar.removeEventListener(this._polestarProviderId);
125
+ this._polestarProviderId = null;
126
+ }
114
127
 
115
128
  MapMatchingHandler.removeEventListener(this._mapMatchingHandlerId);
116
129
  }
@@ -4,6 +4,7 @@ import { UserPosition } from '@wemap/geo';
4
4
  import { TimeUtils } from '@wemap/utils';
5
5
 
6
6
  import Provider from '../../Provider.js';
7
+ import ProvidersOptions from '../../../ProvidersOptions.js';
7
8
  import EventType from '../../../events/EventType.js';
8
9
  import MissingPoleStarError from '../../../errors/MissingPoleStarError.js';
9
10
  import MissingNativeInterfaceError from '../../../errors/MissingNativeInterfaceError.js';