@wemap/providers 12.9.1 → 12.9.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/dist/index.mjs CHANGED
@@ -328,6 +328,7 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
328
328
  constructor() {
329
329
  super(...arguments);
330
330
  __publicField(this, "discardPositionsAbove", _GnssWifiProvider.DEFAULT_DISCARD_POSITIONS_ABOVE);
331
+ __publicField(this, "enableHighAccuracy", true);
331
332
  __publicField(this, "geoLocationId");
332
333
  __publicField(this, "getName", () => "GnssWifi");
333
334
  __publicField(this, "onNewPosition", (geolocation) => {
@@ -349,7 +350,7 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
349
350
  coords.accuracy,
350
351
  bearing
351
352
  );
352
- if (typeof this.discardPositionsAbove === "number" && coords.accuracy > this.discardPositionsAbove) {
353
+ if (this.enableHighAccuracy && typeof this.discardPositionsAbove === "number" && coords.accuracy > this.discardPositionsAbove) {
353
354
  return;
354
355
  }
355
356
  this.notify(position);
@@ -370,15 +371,27 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
370
371
  this.notifyError(customError);
371
372
  });
372
373
  }
374
+ get positionOptions() {
375
+ return {
376
+ enableHighAccuracy: this.enableHighAccuracy,
377
+ timeout: Infinity,
378
+ maximumAge: 0
379
+ };
380
+ }
373
381
  availability() {
374
382
  return typeof navigator === "object" && navigator.geolocation ? Promise.resolve() : Promise.resolve(new GeolocationApiMissingError());
375
383
  }
376
384
  start() {
385
+ navigator.geolocation.getCurrentPosition(
386
+ this.onNewPosition,
387
+ this.onPositionError,
388
+ this.positionOptions
389
+ );
377
390
  setTimeout(() => {
378
391
  this.geoLocationId = navigator.geolocation.watchPosition(
379
392
  this.onNewPosition,
380
393
  this.onPositionError,
381
- _GnssWifiProvider.POSITION_OPTIONS
394
+ this.positionOptions
382
395
  );
383
396
  }, 150);
384
397
  }
@@ -388,11 +401,6 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
388
401
  }
389
402
  }
390
403
  };
391
- __publicField(_GnssWifiProvider, "POSITION_OPTIONS", {
392
- enableHighAccuracy: true,
393
- timeout: Infinity,
394
- maximumAge: 0
395
- });
396
404
  __publicField(_GnssWifiProvider, "DEFAULT_DISCARD_POSITIONS_ABOVE", 50);
397
405
  let GnssWifiProvider = _GnssWifiProvider;
398
406
  const GnssWifiProvider$1 = new GnssWifiProvider();