Skip to content

Instantly share code, notes, and snippets.

@cms
Created August 13, 2019 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cms/2d571ed4cdd843f81f229a2bc22a9aef to your computer and use it in GitHub Desktop.
Save cms/2d571ed4cdd843f81f229a2bc22a9aef to your computer and use it in GitHub Desktop.
navigator.geolocation.getCurrentPosition promise
function getCurrentPosition(options) {
return new Promise(function(resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
(async () => {
const position = await getCurrentPosition().catch(err => console.log(err));
console.log(position);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment