From c49e181cdb13d3357d76759e5311746ffe00f281 Mon Sep 17 00:00:00 2001 From: Adam Byrtek Date: Tue, 24 Feb 2015 21:00:13 +0000 Subject: Send last event data when a widget is ready --- javascripts/dashing.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'javascripts') 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) -- cgit v1.2.3