summaryrefslogtreecommitdiff
path: root/javascripts
diff options
context:
space:
mode:
authorPeter Hamberg <Zazcallabah@users.noreply.github.com>2016-11-29 10:28:19 +0100
committerGitHub <noreply@github.com>2016-11-29 10:28:19 +0100
commita61c20be2d519591ef64960734b1b2bd70893fbe (patch)
tree7cbd9b11a4136a55f6018232da82f527722c878b /javascripts
parentf08bbc16148a6eecf0c0166ce95cbdf956306209 (diff)
Add data transformation method to widget base
in order to make it possible to transform the incoming data before it is sent to batman.
Diffstat (limited to 'javascripts')
-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) ->