flyd issue #120 switchLatest: stream subscribers called more than once
see https://github.com/paldepind/flyd/issues/120
var flyd, mapped, stream, switchLatest;
flyd = require('flyd');
switchLatest = require('flyd/module/switchlatest');
stream = flyd.stream(3);
mapped = switchLatest(stream.map(function(x) {
return flyd.stream(x * 2);
}));
flyd.on((function(value) {
return console.log('!!!! stream ended', value);
}), stream.end);
flyd.on((function(value) {
return console.log('-----!!! mapped ended', value);
}), mapped.end);
flyd.on((function(value) {
return console.log('\n# stream value', value);
}), stream);
flyd.on((function(value) {
return console.log('---> mapped value', value);
}), mapped);
setTimeout(function() {
return stream(4);
});
stream(5);
setTimeout(function() {
stream(16);
stream.end(true);
return stream('bad');
});
no comments