x < 9?
const inc$ = sources.DOM.select('.inc').events('click').mapTo(+1); const refresh$ = sources.DOM.select('.ref').events('click').startWith(0); + const sum$ = inc$.fold((x, y) => x + y, 0); + const lastSum$ = refresh$.map(_ => sum$).flatten(); - const lastSum$ = refresh$.map(_ => inc$.fold((x, y) => x + y, 0)).flatten(); const vdom$ = lastSum$.map(count => div([
flattenthe new subscriber will be added before the old one is removed ensuring the
sum$never goes down to zero subscribers, thus causing it to never reset. RxJS does synchronous unsubscribe during
switchMapthus in RxJS the
sum$would go from one down to zero subscribers temporarily before immediately adding the new subscriber and going from zero back to one subscriber (resetting it). The reset from zero subscribers would happen in either version of the code...