Skip to content

Instantly share code, notes, and snippets.

@mcmire
Created August 24, 2015 16:39
Show Gist options
  • Save mcmire/ca7fb9d3470a3b5c3a23 to your computer and use it in GitHub Desktop.
Save mcmire/ca7fb9d3470a3b5c3a23 to your computer and use it in GitHub Desktop.
getClientLocation = ->
new Promise (resolve, reject) ->
success = (position) ->
resolve(position.coords)
error = (positionError) ->
error = new Error("Error fetching client location: " + positionError.message)
reject(error)
navigator.geolocation.getCurrentPosition(success, error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment