Skip to content

Instantly share code, notes, and snippets.

@crrmacarse
Last active January 28, 2020 07:32
Show Gist options
  • Save crrmacarse/35147883637b3fb31ba3e1e8d8e92853 to your computer and use it in GitHub Desktop.
Save crrmacarse/35147883637b3fb31ba3e1e8d8e92853 to your computer and use it in GitHub Desktop.
Get current location of User
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