Created
November 12, 2019 10:23
-
-
Save omas-public/1a428632ea7df1e1cbcd13dd8cb056ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getCurrentPosition = async () => { | |
const geolocation = options => new Promise((resolve, reject) => | |
navigator.geolocation.getCurrentPosition(resolve, reject, options) | |
) | |
const options = { enableHighAccuracy: true } | |
const position = await geolocation(options) | |
.then(json => json.coords) | |
.then(coords => ({ latitude: coords.latitude, longitude: coords.longitude })) | |
.catch(error => console.log(error)) | |
return position | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment