📝 Add geo location set variable example
This commit is contained in:
@@ -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"
|
alt="Set variable map item with same index"
|
||||||
/>
|
/>
|
||||||
</Frame>
|
</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}`
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user