How to model a looped/recursive/circular observable? #7149
Unanswered
nandin-borjigin
asked this question in
Q&A
Replies: 1 comment
-
You can use Also, I would keep the subject as something internal from your function. And don't forget to function system(a$) {
const xSubject = new Subject()
const m$ = a$.pipe(
withLatestFrom(xSubject.pipe(startWith(...))),
...,
share() // share or shareReplay? you'll need to think about this too...
);
const x$ = m$.pipe(..., tap(r => xSubject.next(r)))
return {
m$,
x$
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For a simple loop, I could use
scan
operator. But as demonstrated in the graph, I need to extract an intermediate observablem$
, and I don't think it's feasible withscan
operator.I can think of a simple way using Subjects but it requires explicit subscription handling which doesn't seem to be an elegant and idiomatic way of using Rx.
Beta Was this translation helpful? Give feedback.
All reactions