Skip to content
raimohanska edited this page Oct 8, 2012 · 31 revisions

Welcome to the bacon.js wiki.

Here are some diagrams that illustrate the functioning of some Bacon.js methods.

merge

Merges events from both streams into the result stream.

merge

Result stream ends when both streams have ended.

combine

Combines the latest values of two streams/properties using a given function. In this example, a self-explanatory plus function is used.

combine

First output event is generated when both streams have produced a value. The combined stream ends when either of the inputs ends.

flatMap

Creates a new stream for each value in the source stream, using the given function f. Merges the events from all created streams into the result stream.

flatMap

Result stream ends when both the source stream and all the so-far created streams have ended.

switch

Like flatMap, switch creates new streams for each source event. Instead of merging all created streams, it "switches" between them so that when a new stream is created, the earlierly created stream is no longer listened to.

switch

Result stream ends when source stream has ended and the latest created stream has ended.

Clone this wiki locally