title: How to use Async Wait with HTML5 GeoLocation API?
body: <p>The first method returns promise.</p>
  
  <pre><code>getCoordinates() {
    return new Promise(function(resolve, reject) {
      navigator.geolocation.getCurrentPosition(resolve, reject);
    });
  }
  </code></pre>
  
  <p>Returns the result of <code>reverseGeoCode</code> method.</p>
  
  <pre><code>async getAddress() {
    await this.getCoordinates().then(position =&gt; {
      let latitude = position.coords.latitude;
      let longitude = position.coords.longitude;
      let url = Constants.OSMAP_URL + latitude + "&amp;lon=" + longitude;
      // Reverse geocoding using OpenStreetMap
      return this.reverseGeoCode(url);
    });
  }
  </code></pre>
  
  <p>Uses custom class to make an API call and return the result.</p>
  
  <pre><code>reverseGeoCode(url) {
    let requestService = new RequestService("json", url);
    requestService.call().then(result =&gt; {
      return result;
    });
  }
  </code></pre>
  
  <p>This is how I call:</p>
  
  <pre><code>let geoLocation = new GeoLocation();
  geoLocation.getAddress().then(r =&gt; {
    console.log(r);
  });
  </code></pre>
  
  <p>The console logs undefined.</p>