-
Notifications
You must be signed in to change notification settings - Fork 6
Upgrading to gaffa 1.11.0 (and 1.10)
Kory Nunn edited this page Jul 16, 2014
·
1 revision
There are no breaking changes for end developers from 1.9.0
For viewItem developers, the method for checking if the value of a property has changed since last time has changed to a much better system as outlined below. Any custom sameAsPrevious methods will no longer be used.
you can now specify when a property will update via the watchChanges property:
var linkItems = new Link();
linkItems.source.binding = '(filter [items] {item (< item.size 10)})';
linkItems.source.watchChanges = 'keys';
// The source property will only update if the result of its
// binding has different keys to its previous result
linkItems.target.binding = '[filteredItems]';
Arbitrary scope can be manually assigned to ViewItems and Properties. This makes passing values into expressions much easier:
var set = new Set();
set.source.binding = '(+ a b)';
set.source.scope = {
a:1,
b:2
};
set.target.binding = '[thing]';
scope is inherited from parent ViewItems or Properties, and may be modified by certain ViewItems, eg:
// A child action to trigger.
var set = new Set();
set.source.binding = 'number'; // 'number' has been put in scope by the Scope action.
set.target.binding = '[number]';
// A scope action puts a variable, 'number' into scope, with the value of 123
var scope = new Scope();
scope.scope.value = {number:123};
// Assign the child to be run when the scope action is triggered.
scope.actions.trigger = [set];