Skip to content

Instantly share code, notes, and snippets.

@kbaum
Last active December 19, 2015 12:49
Show Gist options
  • Save kbaum/5958155 to your computer and use it in GitHub Desktop.
Save kbaum/5958155 to your computer and use it in GitHub Desktop.
class Viewthespace.BuildingTrafficDashboard
constructor: (pusherKey, uniqueUserId) ->
pusher = new Pusher pusherKey
channel = pusher.subscribe "dashboard_results_#{uniqueUserId}"
dashboard = @
channel.bind 'top_traffic_sources', (trafficSources) ->
dashboard.refreshTopTrafficSources trafficSources
channel.bind 'top_prospects_as_json', (topProspects) ->
dashboard.refreshTopProspects topProspects
channel.bind 'top_spaces_as_json', (topSpaces) ->
dashboard.refreshTopSpaces topSpaces
channel.bind 'day_of_week_comparison', (data) ->
dashboard.refreshDayOfWeekComparison data
channel.bind 'pusher:subscription_succeeded', ->
$form.trigger "submit.rails"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment