Skip to content

Instantly share code, notes, and snippets.

@SergeyKhval
SergeyKhval / geolocation.js
Last active May 23, 2018 11:10
Promised version of getting user's geolocation
function getPositionPromised() {
function successCb(resolve) {
return position => resolve(position);
}
function errorCb(reject) {
return () => reject('Could not retrieve geolocation');
}
return new Promise((resolve, reject) => {