diff options
author | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-08-24 15:50:12 -0400 |
---|---|---|
committer | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-08-24 15:50:12 -0400 |
commit | c3ccc8f11619bc1d182d6c7e73ce160699ff27c7 (patch) | |
tree | b660ba1bdf48c961409946b886f2353f56ab5034 /javascripts | |
parent | 54c6a04b722663b518bf99b4d98a1c2e86ee5103 (diff) |
You no longer need to call 'super' inside your onData callbacks for widgets.
Also, every widget now has a 'updatedAt' property that gets updated when data comes in.
Diffstat (limited to 'javascripts')
-rw-r--r-- | javascripts/dashing.coffee | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index 2d9953d..d3bf519 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -45,9 +45,13 @@ class Dashing.Widget extends Batman.View @::on 'ready', -> Dashing.Widget.fire 'ready' - onData: (data) => + receiveData: (data) => @mixin(data) + @set 'updatedAt', new Date() + @onData(data) + onData: (data) => + # Widgets override this to handle incoming data Dashing.AnimatedValue = get: Batman.Property.defaultAccessor.get @@ -89,7 +93,7 @@ source.addEventListener 'message', (e) => lastEvents[data.id] = data if widgets[data.id]?.length > 0 for widget in widgets[data.id] - widget.onData(data) + widget.receiveData(data) $(document).ready -> |