Ask for geolocation on post message

This commit is contained in:
Alessio Davoli 2023-07-18 17:27:03 +02:00
parent cf982fccec
commit e451902f38

View file

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