Skip to content

Instantly share code, notes, and snippets.

@didiraja
Last active August 11, 2020 21:31

Revisions

  1. didiraja revised this gist Aug 11, 2020. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -6,14 +6,14 @@

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

    `navigator.geolocation.getCurrentPosition((response) => console.log(response))` encurtado
  2. didiraja renamed this gist Aug 11, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. didiraja created this gist Aug 11, 2020.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    `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:
    ```json
    coords: {
    latitude: -22.848907399999998,
    longitude: -43.3197986,
    altitude: null,
    accuracy: 27637,
    altitudeAccuracy: null
    },
    timestamp: 1597181042262
    ```

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