I have the following code:
const kickstart$ = curry((pred, iStream, hStream) =>
iStream()
.pipe(
take(1),
flatMap(({processId: pid}) => poller$(hStream(pid))),
takeWhile(pred),
catchError(x => of(x))
)
)
The takeWhile
statement is there to stop the stream once the pred
function returns false. The problem is, I also want those final values to be emitted so that the subscriber can know what the final state of the stream was, which contains information like status: stopped
or status: error
, but then I want it to end after that.
If I only check for status !== "stopped" || status !== "error"
in my takeWhile
, then that final event will not get emitted.
How do I also include that final event?