var person = new can.DefineMap({name: "Justin"});
// Create a stream from person's name
var nameStream = can.streamKefir.toStream(person,".name");
// Every time `.name` changes, increase the count 1.
var nameChangeCountStream = nameStream.scan(function(lastValue){
return lastValue + 1;
}, 0);
// Log the current nameChangeStream value
nameChangeStream.onValue(function(newValue){
console.log(newValue);
});
person.name = "Ramiya" // logs 1
person.name = "Payal" // logs 2
but the example won't work because it is not included in the global namespace.
This package is used as an example in the Advanced Weather Report:
but the example won't work because it is not included in the global namespace.
https://github.com/canjs/can-stream-kefir/blob/master/can-stream-kefir.js#L88