@wemap/providers 9.0.5 → 9.0.6
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",
|
|
12
|
-
"@wemap/geo": "^9.0.
|
|
12
|
+
"@wemap/geo": "^9.0.6",
|
|
13
13
|
"@wemap/geomagnetism": "^0.1.1",
|
|
14
14
|
"@wemap/logger": "^9.0.0",
|
|
15
|
-
"@wemap/map": "^9.0.
|
|
15
|
+
"@wemap/map": "^9.0.6",
|
|
16
16
|
"@wemap/maths": "^9.0.0",
|
|
17
|
-
"@wemap/osm": "^9.0.
|
|
18
|
-
"@wemap/routers": "^9.0.
|
|
17
|
+
"@wemap/osm": "^9.0.6",
|
|
18
|
+
"@wemap/routers": "^9.0.6",
|
|
19
19
|
"@wemap/utils": "^9.0.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.
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"version": "9.0.6",
|
|
46
|
+
"gitHead": "a19cb8d019e18a47cd5fd1ee1b6c02d6bae5acad"
|
|
47
47
|
}
|
|
@@ -23,7 +23,7 @@ class Provider {
|
|
|
23
23
|
id;
|
|
24
24
|
|
|
25
25
|
/** @type {number} */
|
|
26
|
-
state = ProviderState.
|
|
26
|
+
state = ProviderState.STOPPED;
|
|
27
27
|
|
|
28
28
|
/** @type {ProviderEvent[]} */
|
|
29
29
|
_lastEvents = null;
|
|
@@ -170,7 +170,7 @@ class Provider {
|
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
// If the provider is already started do not go further
|
|
173
|
-
if (this.state !== ProviderState.
|
|
173
|
+
if (this.state !== ProviderState.STOPPED) {
|
|
174
174
|
return id;
|
|
175
175
|
}
|
|
176
176
|
this.state = ProviderState.STARTING;
|
|
@@ -181,23 +181,24 @@ class Provider {
|
|
|
181
181
|
availabilityPromise = this.availability;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
(async () => {
|
|
185
|
+
try {
|
|
186
|
+
await availabilityPromise;
|
|
187
|
+
} catch (e) {
|
|
188
|
+
this.state = ProviderState.STOPPED;
|
|
189
|
+
this.notifyError(e);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
186
192
|
|
|
187
|
-
|
|
188
|
-
// Call the child start function
|
|
189
|
-
this.start();
|
|
193
|
+
ProvidersLoggerOld.addEvent(this, 'start');
|
|
190
194
|
|
|
191
|
-
|
|
195
|
+
// Call the child start function
|
|
196
|
+
this.start();
|
|
192
197
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
this.notifyError(e);
|
|
198
|
-
})
|
|
199
|
-
// notifyError can throw an error if onStop is not defined
|
|
200
|
-
.catch(() => { });
|
|
198
|
+
this.state = ProviderState.STARTED;
|
|
199
|
+
|
|
200
|
+
this._monitoringCallbacks.forEach(({ onStarted }) => onStarted());
|
|
201
|
+
})();
|
|
201
202
|
|
|
202
203
|
return id;
|
|
203
204
|
}
|
|
@@ -230,7 +231,7 @@ class Provider {
|
|
|
230
231
|
|
|
231
232
|
// If the provider is already stopped, do not stop it again.
|
|
232
233
|
// This condition can be true if checkAvailabilityOnStart is true and returns an error
|
|
233
|
-
if (this.state === ProviderState.
|
|
234
|
+
if (this.state === ProviderState.STOPPED) {
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
236
237
|
|
|
@@ -238,7 +239,7 @@ class Provider {
|
|
|
238
239
|
// Call the child stop function
|
|
239
240
|
this.stop();
|
|
240
241
|
|
|
241
|
-
this.state = ProviderState.
|
|
242
|
+
this.state = ProviderState.STOPPED;
|
|
242
243
|
|
|
243
244
|
this._monitoringCallbacks.forEach(({ onStopped }) => onStopped());
|
|
244
245
|
}
|
|
@@ -59,7 +59,7 @@ describe('Provider', () => {
|
|
|
59
59
|
await sleep(2);
|
|
60
60
|
|
|
61
61
|
expect(errored).is.true;
|
|
62
|
-
expect(FakeProvider2.state).equals(ProviderState.
|
|
62
|
+
expect(FakeProvider2.state).equals(ProviderState.STOPPED);
|
|
63
63
|
expect(FakeProvider2._eventsCallbacks.length).equals(0);
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -76,7 +76,7 @@ describe('Provider', () => {
|
|
|
76
76
|
expect(FakeProvider2.state).equals(ProviderState.STARTED);
|
|
77
77
|
|
|
78
78
|
FakeProvider2.removeEventListener(id);
|
|
79
|
-
expect(FakeProvider2.state).equals(ProviderState.
|
|
79
|
+
expect(FakeProvider2.state).equals(ProviderState.STOPPED);
|
|
80
80
|
expect(FakeProvider2._eventsCallbacks.length).equals(0);
|
|
81
81
|
|
|
82
82
|
ProvidersOptions.checkAvailabilityOnStart = true;
|
|
@@ -35,7 +35,7 @@ class CameraNative extends Provider {
|
|
|
35
35
|
*/
|
|
36
36
|
start() {
|
|
37
37
|
|
|
38
|
-
if (ArCore.state !== ProviderState.
|
|
38
|
+
if (ArCore.state !== ProviderState.STOPPED) {
|
|
39
39
|
this.notify(this.createEvent(EventType.CameraNative, 'started'));
|
|
40
40
|
}
|
|
41
41
|
this.providerId = ArCore.addMonitoringListener(
|
|
@@ -126,7 +126,7 @@ class Vps extends Provider {
|
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
while (this.state !== ProviderState.
|
|
129
|
+
while (this.state !== ProviderState.STOPPED) {
|
|
130
130
|
|
|
131
131
|
// 1. Handle the time to wait between two requests (MIN_TIME_BETWEEN_TWO_REQUESTS)
|
|
132
132
|
if (this.lastEvent) {
|
|
@@ -136,7 +136,7 @@ class Vps extends Provider {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// 2. Check if Vps is not stopped and camera is still started
|
|
139
|
-
if (this.state === ProviderState.
|
|
139
|
+
if (this.state === ProviderState.STOPPED
|
|
140
140
|
|| !this._camera
|
|
141
141
|
|| this._camera.state !== Camera.State.STARTED) {
|
|
142
142
|
break;
|
|
@@ -164,7 +164,7 @@ class Vps extends Provider {
|
|
|
164
164
|
const attitude = new Attitude(deviceQuaternion, res.attitude.time, res.attitude.accuracy);
|
|
165
165
|
|
|
166
166
|
// 5. Finally, notify the listeners if the VPS is not stopped
|
|
167
|
-
if (this.state === ProviderState.
|
|
167
|
+
if (this.state === ProviderState.STOPPED) {
|
|
168
168
|
break;
|
|
169
169
|
}
|
|
170
170
|
|