Skip to content

Instantly share code, notes, and snippets.

@jeffrydegrande
Last active December 11, 2015 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffrydegrande/4557253 to your computer and use it in GitHub Desktop.
Save jeffrydegrande/4557253 to your computer and use it in GitHub Desktop.
class Ajax
@getJSON: (url, event)->
$.getJSON url, (data)->
Event.trigger(event, data)
class Event
@on: (event, fn)->
$('body').bind event, (_, data) -> fn(data)
@trigger: (event, data)->
$('body').trigger(event, [data])
class Tracker
@fetchAll: ->
Ajax.getJSON "/current_positions", "trackers:ready"
@fetchByUIN: (uin)->
Ajax.getJSON "/trackers/#{uin}", "tracker:ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment