var a = new Bacon.Bus();
var b = a.scan(0, function(x,y) { return x + y; });
a.push(1);
b.onValue(function(value) {
console.log("-> ", value);
});
a.push(2);
I get:
-> 0
-> 2
instead of the expected:
-> 1
-> 3
However if I do a b.log() before the a.push(1) I get the expected result:
var a = new Bacon.Bus();
var b = a.scan(0, function(x,y) { return x + y; });
b.log();
a.push(1);
b.onValue(function(value) {
console.log("-> ", value);
});
a.push(2);
Gives me:
0
1
-> 1
3
-> 3
Is this a bug? Is it expected behaviour? Is there a way to get the behaviour I want without using b.log()?
Thank you for any advice!
Jeff
And just read the FAQ and found information on this!
https://github.com/baconjs/bacon.js/wiki/FAQ
Thank you FAQ!