As a newcomer to bacon.js, I can't seem to understand the difference between an event stream and a property.
- Properties are built from streams (except properties built with
.constant
?) - They have most methods in common
- Subscribing to them works in the same way
Could someone explain the differences and when to use which?
In the example below, stream
and property
have the exact same behaviour. I'm afraid I fail to see beyond this.
var stream = Bacon.sequentially(250, [1, 2, 3, 4, 5, 6, 7, 8]);
var property = stream.toProperty();
stream.onValue(function (val) {
console.log("Stream", val);
});
property.onValue(function (val) {
console.log("Property", val);
});