stream.holdWhen not working

26 views
Skip to first unread message

rune...@gmail.com

unread,
Feb 21, 2015, 7:32:07 PM2/21/15
to bac...@googlegroups.com
http://jsbin.com/bopevakexo/1/edit?js,console,output

Why doesn't the above example print stuff to the console when the "do it!" button is pressed?

Pressing that button should fire an event containing the value true, which is mapped into false in "holdStream", and "holdStream" is used to hold lightStream, which produces controlLightStream:


lightStream = Bacon.fromArray([].concat.apply([], pixel_array))

controlLightStream = lightStream.holdWhen(holdStream.toProperty(true))

controlLightStream.onValue((val) -> console.log(val))

But nothing is ever printed to the console.

Juha Paananen

unread,
Feb 22, 2015, 2:59:32 AM2/22/15
to rune...@gmail.com, bac...@googlegroups.com
Hi,

Holdwhen doesn’t work very well with synchronous sources. So, replace fromArray with sequentially, for instance and it’ll work fine.

Cheers,

Juha
> --
> You received this message because you are subscribed to the Google Groups "Bacon.js" group.
> To post to this group, send email to bac...@googlegroups.com.
> Visit this group at http://groups.google.com/group/baconjs.

Reply all
Reply to author
Forward
0 new messages