Closed
Description
This code should print "got value 1" and stop, but instead "got value 1" and "got value 2" are outputted. However, if you add a subscriber to the bus first by adding bus.log();
after defining the bus, it works as expected.
var Bacon = require('baconjs');
var bus = new Bacon.Bus();
var s = Bacon.once(1).merge(Bacon.later(10, 2));
s.takeUntil(bus.mapEnd(null)).onValue(function(value) {
console.log('got value', value);
bus.end();
});
Calling bus.end()
before there are any subscribers usually does nothing (I'm a little uncomfortable with this, but it's not what this issue is specifically). However, the .takeUntil(bus.mapEnd(null))
does add a subscriber to the bus, so I'd expect the later bus.end()
call to work.
Bacon 0.7.41 from NPM
Metadata
Metadata
Assignees
Labels
No labels