@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.js CHANGED
@@ -347,6 +347,7 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
347
347
  constructor() {
348
348
  super(...arguments);
349
349
  __publicField(this, "discardPositionsAbove", _GnssWifiProvider.DEFAULT_DISCARD_POSITIONS_ABOVE);
350
+ __publicField(this, "enableHighAccuracy", true);
350
351
  __publicField(this, "geoLocationId");
351
352
  __publicField(this, "getName", () => "GnssWifi");
352
353
  __publicField(this, "onNewPosition", (geolocation) => {
@@ -368,7 +369,7 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
368
369
  coords.accuracy,
369
370
  bearing
370
371
  );
371
- if (typeof this.discardPositionsAbove === "number" && coords.accuracy > this.discardPositionsAbove) {
372
+ if (this.enableHighAccuracy && typeof this.discardPositionsAbove === "number" && coords.accuracy > this.discardPositionsAbove) {
372
373
  return;
373
374
  }
374
375
  this.notify(position);
@@ -389,15 +390,27 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
389
390
  this.notifyError(customError);
390
391
  });
391
392
  }
393
+ get positionOptions() {
394
+ return {
395
+ enableHighAccuracy: this.enableHighAccuracy,
396
+ timeout: Infinity,
397
+ maximumAge: 0
398
+ };
399
+ }
392
400
  availability() {
393
401
  return typeof navigator === "object" && navigator.geolocation ? Promise.resolve() : Promise.resolve(new GeolocationApiMissingError());
394
402
  }
395
403
  start() {
404
+ navigator.geolocation.getCurrentPosition(
405
+ this.onNewPosition,
406
+ this.onPositionError,
407
+ this.positionOptions
408
+ );
396
409
  setTimeout(() => {
397
410
  this.geoLocationId = navigator.geolocation.watchPosition(
398
411
  this.onNewPosition,
399
412
  this.onPositionError,
400
- _GnssWifiProvider.POSITION_OPTIONS
413
+ this.positionOptions
401
414
  );
402
415
  }, 150);
403
416
  }
@@ -407,11 +420,6 @@ const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
407
420
  }
408
421
  }
409
422
  };
410
- __publicField(_GnssWifiProvider, "POSITION_OPTIONS", {
411
- enableHighAccuracy: true,
412
- timeout: Infinity,
413
- maximumAge: 0
414
- });
415
423
  __publicField(_GnssWifiProvider, "DEFAULT_DISCARD_POSITIONS_ABOVE", 50);
416
424
  let GnssWifiProvider = _GnssWifiProvider;
417
425
  const GnssWifiProvider$1 = new GnssWifiProvider();