From f7b1b7fe0dc92bcc7902b5614062f80a1ac916eb Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 21 Apr 2026 20:13:53 +0100 Subject: [PATCH] Update geohash (location services) logic to improve time to first hit --- src/lib/geohash.svelte.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/geohash.svelte.ts b/src/lib/geohash.svelte.ts index 8c6f575..60f956b 100644 --- a/src/lib/geohash.svelte.ts +++ b/src/lib/geohash.svelte.ts @@ -7,10 +7,16 @@ class NearestStationsState { loading = $state(true); error = $state(null); + private initGeoConfig: PositionOptions = { + enableHighAccuracy: false, + timeout: 500, + maximumAge: Infinity, + } + private geoConfig: PositionOptions = { enableHighAccuracy: false, - timeout: 30000, - maximumAge: 120000 + timeout: 20000, + maximumAge: 30000, }; constructor() { @@ -24,7 +30,7 @@ class NearestStationsState { navigator.geolocation.getCurrentPosition( (pos) => this.handleUpdate(pos.coords.latitude, pos.coords.longitude), (err) => this.handleError(err), - this.geoConfig + this.initGeoConfig ); }