Skip to content

Instantly share code, notes, and snippets.

@alindeman
Created December 11, 2011 22:48
Show Gist options
  • Select an option

  • Save alindeman/1463269 to your computer and use it in GitHub Desktop.

Select an option

Save alindeman/1463269 to your computer and use it in GitHub Desktop.
# A Backbone sync that sends along location information, if available
Backbone = this.Backbone
Backbone.locationSync = (method, model, options) ->
options.data = { } unless options.data?
navigator.geolocation.getCurrentPosition (position) ->
options.data.latitude = position.coords.latitude
options.data.longitude = position.coords.longitude
Backbone.sync(method, model, options)
, (error) ->
Backbone.sync(method, model, options)
,
enableHighAccurancy: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment