Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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