In OpenLayers, the geolocation object has a "once" event: https://openlayers.org/en/latest/apidoc/module-ol_Geolocation-Geolocation.html#once
How can I use this event?
This throws an error:
// Vue
export default {
data() {
return { geolocation: null }
},
mounted() {
this.geolocation = new Geolocation({ ... })
},
methods: {
geolocAtPoint() {
// Here I would expect geolocation data that is return only once...
console.log('this.geolocation.once("change:position") =',
this.geolocation.once('change:position'))
}
}
Eventually, I would like to be able to tab on the map and get the geolocation data of that very point (corresponding to the vanilla "navigator.geolocation.getCurrentPosition(...)").