export const LocateMe = { mounted() { this.el.addEventListener("click", () => { if (!navigator.geolocation) { alert("Geolocation is not supported by this browser") return } this.el.classList.add("loading", "loading-spinner") navigator.geolocation.getCurrentPosition( (pos) => { this.el.classList.remove("loading", "loading-spinner") this.pushEvent("gps_location", { lat: pos.coords.latitude, lon: pos.coords.longitude }) }, (err) => { this.el.classList.remove("loading", "loading-spinner") alert("Could not get location: " + err.message) }, { enableHighAccuracy: true, timeout: 10000 } ) }) } }