Skip to content
This repository was archived by the owner on Mar 7, 2018. It is now read-only.

Commit 60dcd73

Browse files
committed
only fire dashboard events when target is current dashboard
* send event to all dashboards by including {"dashboard": "*"} in payload * reload event forces reload from server, no caching
1 parent 5f8cbcb commit 60dcd73

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

javascripts/dashing.coffee

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ Batman.Filters.shortenedNumber = (num) ->
2626

2727
class window.Dashing extends Batman.App
2828
@on 'reload', (data) ->
29-
if data.dashboard?
30-
location.reload() if window.location.pathname is "/#{data.dashboard}"
31-
else
32-
location.reload()
29+
window.location.reload(true)
3330

3431
@root ->
3532
Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));
@@ -89,6 +86,7 @@ Dashing.AnimatedValue =
8986
@[k] = num
9087
@set k, to
9188
, 10
89+
@[k] = num
9290

9391
Dashing.widgets = widgets = {}
9492
Dashing.lastEvents = lastEvents = {}
@@ -117,7 +115,8 @@ source.addEventListener 'dashboards', (e) ->
117115
data = JSON.parse(e.data)
118116
if Dashing.debugMode
119117
console.log("Received data for dashboards", data)
120-
Dashing.fire data.event, data
118+
if data.dashboard is '*' or window.location.pathname is "/#{data.dashboard}"
119+
Dashing.fire data.event, data
121120

122121
$(document).ready ->
123122
Dashing.run()

0 commit comments

Comments
 (0)