summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Mauthe <me@tylermauthe.com>2017-05-26 05:28:44 -0700
committerGitHub <noreply@github.com>2017-05-26 05:28:44 -0700
commit044384ae767abcd577a20488919c3d8958d48b9c (patch)
tree87992416221821ae9ba2fb6f547af71dcc0777a3
parent464aee17ca8e42b71e12ff7d490141e7c6e09c18 (diff)
parenta61c20be2d519591ef64960734b1b2bd70893fbe (diff)
Merge pull request #25 from Zazcallabah/master
Add data transformation method to widget base
-rw-r--r--javascripts/dashing.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index 20a9987..a85d595 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -57,16 +57,22 @@ class Dashing.Widget extends Batman.View
# In case the events from the server came before the widget was rendered
lastData = Dashing.lastEvents[@id]
if lastData
+ lastData = @select(lastData)
@mixin(lastData)
@onData(lastData)
receiveData: (data) =>
+ data = @select(data)
@mixin(data)
@onData(data)
onData: (data) =>
# Widgets override this to handle incoming data
+ select: (data) =>
+ # Widgets override this to transform data before it is applied to the model
+ return data
+
Dashing.AnimatedValue =
get: Batman.Property.defaultAccessor.get
set: (k, to) ->