When a remembered source receives a value, that value is not emitted to late subscribers unless that source has already been subscribed to.
import remember from "callbag-remember";
import { pipe, forEach } from "callbag-basics";
import fromFunction from "callbag-from-function";
const { source, emitter } = fromFunction();
const rem$ = remember(source);
// Late subscription does not receive the value unless early subscription enabled
/*
pipe(
rem$,
forEach(value => {
console.log("early-subscribe", value);
})
);
*/
emitter(111);
setTimeout(() => {
pipe(
rem$,
forEach(value => {
console.log("late-subscribe", value);
})
);
}, 1000);
When a remembered source receives a value, that value is not emitted to late subscribers unless that source has already been subscribed to.
Perhaps this is the intended behavior, but to me this was unexpected. See: https://stackblitz.com/edit/js-t8rvxy?file=index.js