Permalink
Browse files

Send last event data when a widget is ready

  • Loading branch information...
1 parent e18a162 commit c49e181cdb13d3357d76759e5311746ffe00f281 @adambyrtek adambyrtek committed Feb 24, 2015
Showing with 6 additions and 6 deletions.
  1. +6 −6 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)

0 comments on commit c49e181

Please sign in to comment.