summaryrefslogtreecommitdiff
path: root/javascripts
diff options
context:
space:
mode:
authorAdam Byrtek <adambyrtek@gmail.com>2015-02-24 21:00:13 +0000
committerAdam Byrtek <adambyrtek@gmail.com>2015-02-24 21:00:13 +0000
commitc49e181cdb13d3357d76759e5311746ffe00f281 (patch)
treecc96d905c0861963a6f0a092bcc8cfa9ff3f3842 /javascripts
parente18a162b663e5e0a924d3a884ad1c64f75e8cf8d (diff)
Send last event data when a widget is ready
Diffstat (limited to 'javascripts')
-rw-r--r--javascripts/dashing.coffee12
1 files changed, 6 insertions, 6 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index f41a279..20a9987 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -41,12 +41,6 @@ class Dashing.Widget extends Batman.View
Dashing.widgets[@id] ||= []
Dashing.widgets[@id].push(@)
- # In case the events from the server came before the widget was rendered
- lastData = Dashing.lastEvents[@id]
- if lastData
- @mixin(lastData)
- @onData(lastData)
-
type = Batman.Filters.dashize(@view)
$(@node).addClass("widget widget-#{type} #{@id}")
@@ -60,6 +54,12 @@ class Dashing.Widget extends Batman.View
@::on 'ready', ->
Dashing.Widget.fire 'ready'
+ # In case the events from the server came before the widget was rendered
+ lastData = Dashing.lastEvents[@id]
+ if lastData
+ @mixin(lastData)
+ @onData(lastData)
+
receiveData: (data) =>
@mixin(data)
@onData(data)