From a61c20be2d519591ef64960734b1b2bd70893fbe Mon Sep 17 00:00:00 2001 From: Peter Hamberg Date: Tue, 29 Nov 2016 10:28:19 +0100 Subject: Add data transformation method to widget base in order to make it possible to transform the incoming data before it is sent to batman. --- javascripts/dashing.coffee | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'javascripts') 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) -> -- cgit v1.2.3