Bacon.js:流和 属性 之间的实际区别

Bacon.js: practical difference between a stream and a property

作为 bacon.js 的新手,我似乎无法理解事件流和 属性 之间的区别。

有人可以解释一下差异以及何时使用哪个吗?

在下面的示例中,streamproperty 具有完全相同的行为。恐怕我看不到更多。

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);
});

Bacon.js属性是FRP文献中的行为EventStreams只是 事件 。它们看起来很相似,但在语义上却大不相同。

熟悉 FRP 概念,例如通过阅读 this answer.