Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(operators): startWithFuture #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Andrew-Bekhiet
Copy link

Adds a new operator that works like startWith but accepts a future

The whole idea is like this:

Stream.fromFuture(someFuture).switchMap((resolvedValue) => this.startWith(resolvedValue))

@hoc081098
Copy link
Owner

hoc081098 commented Dec 26, 2022

Is this operator necessary? I think using Rx.concat([future.asStream(), this]) is more idiomatic

@Andrew-Bekhiet
Copy link
Author

I found myself repeating the implementation in my code so I wrote the extension and thought it might be useful for others too

Hmm yeah sure I think I just wrote the implementation that first came to my mind

@hoc081098
Copy link
Owner

@Andrew-Bekhiet.
It is not clear if we use it with broadcast stream, we can miss events before the future completes.
Either concat or concatEager is the best for all cases?

test(startWithFuture): simulate delay to ensure no events were dropped
@Andrew-Bekhiet
Copy link
Author

Sorry for being a little too late for this

Yes I think concatEager will be better so I changed the implementation

@hoc081098
Copy link
Owner

Sorry for being a little too late for this

Yes I think concatEager will be better so I changed the implementation

Thanks 👍
I will look at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants