feat(breaking): update startWith so that it calls a function to get first value #6235
jorroll
started this conversation in
Ideas / Feature request
Replies: 3 comments 1 reply
-
Moved into discussions since issue is being used for core team's bug tracking purpose. |
Beta Was this translation helpful? Give feedback.
0 replies
-
A question related to this has popped up before. There is already a general solution in the library for making things lazy: |
Beta Was this translation helpful? Give feedback.
1 reply
-
you can always use concat(
defer(() => { /* get value here */ return of('value'); }),
source
) Or roll your own operator: const startWithDeferred = <T, V>(factory: () => V) => (source: Observable<T>) => concat(defer(() => of(factory())), source); |
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.
-
Feature Request
This is a re-opening of issue #5156 which was originally closed because, at the time, it was stated that breaking changes would not be considered to the RXJS core library. Seeing as RXJS has a breaking release being worked on (v7), I'm resurfacing this old discussion.
This is a request to change the
startWith
operator so it expects a function which is called to retrieve the first value.I.e. update
startWith
interface from this:to this:
See issue #5156 for previous discussion on this topic including this closing comment by
@kwonoj
.Beta Was this translation helpful? Give feedback.
All reactions