Last active
January 28, 2020 07:32
-
-
Save crrmacarse/35147883637b3fb31ba3e1e8d8e92853 to your computer and use it in GitHub Desktop.
Get current location of User
This file contains 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
export default () => { | |
try { | |
const geoLocation = navigator.geolocation; | |
return new Promise((resolve, reject) => { | |
geoLocation.getCurrentPosition(resolve, reject, { | |
enableHighAccuracy: true, | |
}); | |
}); | |
} catch (error) { | |
return error; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment