From 6914d99bda53f7732988a61b639165b54d9b8cfd Mon Sep 17 00:00:00 2001 From: Adam Byrtek Date: Tue, 24 Feb 2015 20:18:14 +0000 Subject: Trigger onData on widget initialization --- javascripts/dashing.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'javascripts') diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index e5875d8..c66128d 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -40,7 +40,12 @@ class Dashing.Widget extends Batman.View @mixin($(@node).data()) Dashing.widgets[@id] ||= [] Dashing.widgets[@id].push(@) - @mixin(Dashing.lastEvents[@id]) # in case the events from the server came before the widget was rendered + + # 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}") -- cgit v1.2.3