Add geolocalization
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alessio Davoli 2023-07-18 17:31:01 +02:00
parent e451902f38
commit bfba81c09b
2 changed files with 7 additions and 12 deletions

View file

@ -4,12 +4,9 @@ let longitude;
onmessage = () => {
const watchID = navigator.geolocation.watchPosition((position) => {
latitude = position.coords.latitude;
longitude = position.coords.longitude;
});
console.log({latitude, longitude});
};
export { };

View file

@ -11,13 +11,11 @@
/* geolocation is not available */
return;
}
const SyncWorker = await import('$lib/gps.worker.ts');
syncWorker = new SyncWorker.default();
syncWorker.postMessage([]);
syncWorker.onmessage = (data) => {
console.log(data);
}
const watchID = navigator.geolocation.watchPosition((position) => {
latitude = position.coords.latitude;
longitude = position.coords.longitude;
console.log({latitude, longitude});
});
};
onMount(loadWorker);