Bacon.js onValue() chain

580 Views Asked by At

Why the construction like

$("#clickme").asEventStream('click').onValue(callback1).onValue(callback2);

doesn't work, but this one

var promise = $("#clickme").asEventStream('click');
promise.onValue(callback1);
promise.onValue(callback2);

works.

Doesn't the onValue method return reference to object? Is any purpose of that?

1

There are 1 best solutions below

1
raimohanska On BEST ANSWER

The onValue method returns a function for unsubscribing, hence is not chainable.