2
0

📝 Add geo location set variable example

This commit is contained in:
Baptiste Arnaud
2024-02-01 17:29:29 +01:00
parent 3128ebd431
commit 11678ac2fe

View File

@ -121,3 +121,23 @@ This value block allows you to find the `Id` from `Ids` with the same index as `
alt="Set variable map item with same index"
/>
</Frame>
## Get user's geo location
For this you can provide the following custom code:
```js
function getPosition() {
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(
(position) => resolve(position),
(error) => reject(error),
{ enableHighAccuracy: true, timeout: 5000 }
)
})
}
const coords = (await getPosition()).coords
return `${coords.latitude}, ${coords.longitude}`
```