Skip to content

Instantly share code, notes, and snippets.

@pointofpresence
Last active January 10, 2020 07:23
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 pointofpresence/5ec1faf4774601139c188615a157565e to your computer and use it in GitHub Desktop.
Save pointofpresence/5ec1faf4774601139c188615a157565e to your computer and use it in GitHub Desktop.
getCurrentPosition promised
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
.catch((err) => {
console.error(err.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment