Update gps config

This commit is contained in:
Alessio Davoli 2023-07-18 17:19:25 +02:00
parent 72eb8a370f
commit 8b38abcd9e
2 changed files with 14 additions and 7 deletions

View file

@ -1,10 +1,3 @@
if (!("geolocation" in navigator)) {
/* geolocation is not available */
return;
}
const watchID = navigator.geolocation.watchPosition((position) => {
console.log(position.coords.latitude, position.coords.longitude);
});

View file

@ -2,6 +2,20 @@
import Header from '$lib/components/Header.svelte';
import Tabs from '$lib/components/Tabs.svelte';
import MapTab from '$lib/components/tabs/MapTab.svelte';
import { onMount } from 'svelte';
let syncWorker: Worker | undefined = undefined;
const loadWorker = async () => {
if (!("geolocation" in navigator)) {
/* geolocation is not available */
return;
}
const SyncWorker = await import('$lib/gps.worker.ts');
syncWorker = new SyncWorker.default();
};
onMount(loadWorker);
export let data;
let divider;