Created
November 23, 2017 10:17
-
-
Save marcusasplund/6bee62385985886be562f338c7b38b06 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
// getCurrentPosition() | |
// .then((position) => console.log(position.coords.latitude)) | |
const getCurrentPosition = () => { | |
return new Promise((resolve, reject) => { | |
window.navigator.geolocation | |
.getCurrentPosition((position) => { | |
resolve(position) | |
}, (error) => { | |
reject(error) | |
}, | |
{ | |
enableHighAccuracy: true | |
} | |
) | |
}) | |
} | |
export {getCurrentPosition} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment