Skip to content

Instantly share code, notes, and snippets.

@didiraja
Last active August 11, 2020 21:31
Show Gist options
  • Save didiraja/cbf8de2c9e871e62d1f22d10cacf29dd to your computer and use it in GitHub Desktop.
Save didiraja/cbf8de2c9e871e62d1f22d10cacf29dd to your computer and use it in GitHub Desktop.

navigator.geolocation é a classe

navigator.geolocation.getCurrentPosition() é a API que vc quer

navigator.geolocation.getCurrentPosition(function(response) { return console.log(response) }) é pra pegar a resposta

a resposta:

  'coords': {
    'latitude': -22.848907399999998,
    'longitude': -43.3197986,
    'altitude': null,
    'accuracy': 27637,
    'altitudeAccuracy': null
  },
  'timestamp': 1597181042262

navigator.geolocation.getCurrentPosition((response) => console.log(response)) encurtado

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment