my_Stream是我想要积累并分配给变量以供进一步处理的数据。我的问题是:如何在流完成后将变量the_string的内容传递给console.log?
my_Stream.onValue(function(value) {
the_string = the_string.concat(value);
});我的完整代码可以在github问题页面:Github.com/nodeschool/讨论会/问题/1778中找到
发布于 2016-06-27 07:58:19
您要使用的是fold,它扫描流并仅在流结束时输出值。
const stream = Bacon.sequentially(100, ["Hello", "world"])
stream.log("stream")
const concatenated = stream.fold("", (a,b) => a + b)
concatenated.log("concatenated")http://jsbin.com/yodudiqovi/edit?html,js,console
https://stackoverflow.com/questions/38041302
复制相似问题