Created
May 4, 2018 18:53
-
-
Save lucasdu4rte/dfbcb77aecfbda81d2746274b7811b06 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
| function getLocation(cbSuccess, cbError) { | |
| if (navigator.geolocation) { | |
| return navigator | |
| .geolocation | |
| .getCurrentPosition(cbSuccess, cbError); | |
| } else { | |
| // Browser doesn't support Geolocation | |
| return 'Browser doesnt support Geolocation' | |
| } | |
| } | |
| function geoSuccess(position) { | |
| let lat = position.coords.latitude; | |
| let lng = position.coords.longitude; | |
| this.setState({ | |
| geolocation: { | |
| latitude: lat, | |
| longitude: lng | |
| } | |
| }) | |
| } | |
| function geoError(error) { | |
| console.log(error); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment