Feature Request: catchComplete(Function) operator #5974
Trequetrum
started this conversation in
Ideas / Feature request
Replies: 1 comment 4 replies
-
I think given how trivial it was for you to compose this yourself with: function catchComplete<T, R>(fn: () => Observable<R>): OperatorFunction<T, T|R> {
return s => concat(s, defer(fn));
} That's probably your answer. If we add this as a feature to RxJS, then we're on the hook for maintaining it nearly indefinitely. Meanwhile, we've provided enough tools for people to roll this themselves with a couple of lines of code. |
Beta Was this translation helpful? Give feedback.
4 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.
-
Feature Request
Like
catchError
it would be nice if there were a native way to catch acomplete
stream and replace it with another stream. This lets you chain a new observable into the completion of a previous observable.Here is how I've implemented it in the past.
or
Here is a simple example of this in use:
Alternatives do exist,
Generally:
Can be re-written as:
I would argue that
catchComplete
is more ergonomic and easier to understand than the equivalent use ofconcat
Consider the following two snippets of code:
vs
Beta Was this translation helpful? Give feedback.
All reactions