Skip to content

Instantly share code, notes, and snippets.

@samfcmc
Created August 23, 2019 21:49
Show Gist options
  • Save samfcmc/2881fa45d254e678b97a1c3a5d2db01e to your computer and use it in GitHub Desktop.
Save samfcmc/2881fa45d254e678b97a1c3a5d2db01e to your computer and use it in GitHub Desktop.
export const getUserLocation () {
const userAllowedToGetLocation = askUserPermission();
if (userAllowedToGetLocation) {
return userLocation();
}
else {
throw new Error('User refused to provide location');
}
}
function askUserPermission () {
// Logic to ask user permission to get his/her location
}
function userLocation () {
// Logic to get the user's location
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment