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 = () => {
|
onmessage = () => {
|
||||||
|
|
||||||
const watchID = navigator.geolocation.watchPosition((position) => {
|
|
||||||
latitude = position.coords.latitude;
|
|
||||||
longitude = position.coords.longitude;
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log({latitude, longitude});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { };
|
export { };
|
|
@ -11,13 +11,11 @@
|
||||||
/* geolocation is not available */
|
/* geolocation is not available */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const SyncWorker = await import('$lib/gps.worker.ts');
|
const watchID = navigator.geolocation.watchPosition((position) => {
|
||||||
syncWorker = new SyncWorker.default();
|
latitude = position.coords.latitude;
|
||||||
syncWorker.postMessage([]);
|
longitude = position.coords.longitude;
|
||||||
syncWorker.onmessage = (data) => {
|
console.log({latitude, longitude});
|
||||||
console.log(data);
|
});
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(loadWorker);
|
onMount(loadWorker);
|
||||||
|
|
Loading…
Reference in a new issue