title: How to promisify a function for navigator geolocation?
body: <p>I need to promisify this line of code:</p>
  
  <pre><code>navigator.geolocation.getCurrentPosition(setPosition);
  </code></pre>
  
  <p>Because the result from it is asynchrounus.</p>
  
  <p>I tried this:</p>
  
  <pre><code>await new Promise (resolve =&gt; navigator.geolocation.getCurrentPosition(
    () =&gt; setPosition().then(resolve))
  )
  </code></pre>
  
  <p>But is not working...</p>
  
  <p>My code before was like this:</p>
  
  <pre><code>const setPosition = async (position) =&gt; {
    const lat = await position.coords.latitude
    const lng = await position.coords.longitude
    mapOptions.center = {
      lat: lng,
      lng: lat
    }      
  }
  
  navigator.geolocation.getCurrentPosition(setPosition);
  </code></pre>
  
  <p>Any ideas?</p>