This commit is contained in:
parent
e451902f38
commit
bfba81c09b
2 changed files with 7 additions and 12 deletions
|
@ -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 { };
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue