David Laberge
David Laberge

Reputation: 16051

Combining streams with baconjs

I have asynchronous events that I need combining. I am constructing an array of N streams; each stream has an onValue function to process the returned data.

I have tried combining all of those streams into one onValues on top of the onValue, but it does not get called properly.

var streams = [] 
...
stream = Bacon.fromCallback .... 
stream.onValue...( )

streams.push(stream)

...
Bacon.onValues(streams, f() { .... } )

What would be the right way to have a function called back when EACH stream has a (unique) value... AND when everything is completed?

Upvotes: 1

Views: 118

Answers (1)

Bergi
Bergi

Reputation: 664365

I would assume this does the job:

Bacon.combineAsArray(streams).onEnd(f)

Upvotes: 1

Related Questions