|
|
|
|
|
by WorldMaker
1073 days ago
|
|
I've had some success with writing Async Generator functions in mixed RxJS/IxJS pipelines. async *function someMapOperation() {
const { value, meta } = await getValue(…)
doSomething(meta)
yield value
for await (const { value, meta } of AsyncIterableX.from(mergeAll(…).pipe(takeUntil(…)))) {
doSomething(meta)
yield value
}
// …
}
(I've done similar things in C#, as well, with its Rx/Ix pair.)You are right, there are still good cases where being able to write the "state machine" of a complex flow as an async (generator) function makes it a lot easier to reason with. The nice thing is that Observables work well with AsyncIterables and a pipeline doesn't have to be just one or the other. |
|