From 5f8cbcb7debde027e79d87733b84cb852aa47dad Mon Sep 17 00:00:00 2001 From: Chad Jolly Date: Sun, 14 Jul 2013 18:36:19 -0600 Subject: dashboard events - use SSE event names --- javascripts/dashing.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'javascripts') diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index f90c14b..c4178f3 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -106,10 +106,6 @@ source.addEventListener 'error', (e)-> source.addEventListener 'message', (e) -> data = JSON.parse(e.data) if lastEvents[data.id]?.updatedAt != data.updatedAt - # /messages are internal messages, and cannot correspond to widgets. - # We will handle them as events on the Dashing application. - return Dashing.fire(data.id.slice(1), data) if data.id[0] is '/' - if Dashing.debugMode console.log("Received data for #{data.id}", data) lastEvents[data.id] = data @@ -117,6 +113,11 @@ source.addEventListener 'message', (e) -> for widget in widgets[data.id] widget.receiveData(data) +source.addEventListener 'dashboards', (e) -> + data = JSON.parse(e.data) + if Dashing.debugMode + console.log("Received data for dashboards", data) + Dashing.fire data.event, data $(document).ready -> Dashing.run() -- cgit v1.2.3