Created
August 23, 2019 21:49
-
-
Save samfcmc/2881fa45d254e678b97a1c3a5d2db01e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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