Update gps wrkero

This commit is contained in:
Alessio Davoli 2023-07-18 17:23:04 +02:00
parent 8b38abcd9e
commit cf982fccec
2 changed files with 11 additions and 2 deletions

View file

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

View file

@ -13,6 +13,11 @@
} }
const SyncWorker = await import('$lib/gps.worker.ts'); const SyncWorker = await import('$lib/gps.worker.ts');
syncWorker = new SyncWorker.default(); syncWorker = new SyncWorker.default();
syncWorker.postMessage([]);
syncWorker.onmessage = (data) => {
console.log(data);
}
}; };
onMount(loadWorker); onMount(loadWorker);