Ask for geolocation on post message
This commit is contained in:
parent
cf982fccec
commit
e451902f38
1 changed files with 3 additions and 1 deletions
|
@ -1,12 +1,14 @@
|
||||||
let latitude;
|
let latitude;
|
||||||
let longitude;
|
let longitude;
|
||||||
|
|
||||||
|
|
||||||
|
onmessage = () => {
|
||||||
|
|
||||||
const watchID = navigator.geolocation.watchPosition((position) => {
|
const watchID = navigator.geolocation.watchPosition((position) => {
|
||||||
latitude = position.coords.latitude;
|
latitude = position.coords.latitude;
|
||||||
longitude = position.coords.longitude;
|
longitude = position.coords.longitude;
|
||||||
});
|
});
|
||||||
|
|
||||||
onmessage = () => {
|
|
||||||
console.log({latitude, longitude});
|
console.log({latitude, longitude});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue