Skip to content

Instantly share code, notes, and snippets.

@drale2k
Created March 21, 2012 21:28
Show Gist options
  • Save drale2k/2153016 to your computer and use it in GitHub Desktop.
Save drale2k/2153016 to your computer and use it in GitHub Desktop.
class Etaxi.Routers.Base extends Backbone.Router
routes:
'register' : 'registerDevice'
'a' : 'b'
b: ->
alert "a"
initialize: ->
@registerDevice() unless localStorage.device_id?
@getGeolocation()
registerDevice: ->
@collection = new Etaxi.Collections.Devices()
@collection.fetch()
view = new Etaxi.Views.RegisterDevice(collection: @collection)
$('#wrapper').append(view.render().el)
getGeolocation: ->
navigator.geolocation.getCurrentPosition (position) ->
lat = position.coords.latitude
lng = position.coords.longitude
#$('#apphead').tap ->
# alert 'Position: ' + lat + " ," + lng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment