Computes don't setup bindings on dependent properties until they're bound:
var firstName = can.compute('Chris');
var lastName = can.compute('Gomez');
var fullName = can.compute(function () {
return firstName() + ' ' + lastName();
}); // Nothing is done
fullName.bind('change', function () {
// Do something
}); // Binds to "change" events on `firstName` and `lastName`
We should be able to do something similar with FilteredList's:
var source = new can.List(['a', 'b', 'c']);
var filtered = source.dFilter(function (letter) {
return letter === 'b';
}); // An empty FilteredList is returned
filtered.attr(0); // Iterates `source` until the first element that passes the predicate is found
filtered.bind('add', function () {
// Do something
}); // Binds to "add", "remove" and creates computes for each element in `source`.
Computes don't setup bindings on dependent properties until they're bound:
We should be able to do something similar with
FilteredList's: