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

2.x support another source at takeUntil method #6107

Closed
JSpiner opened this issue Jul 26, 2018 · 4 comments
Closed

2.x support another source at takeUntil method #6107

JSpiner opened this issue Jul 26, 2018 · 4 comments

Comments

@JSpiner
Copy link

JSpiner commented Jul 26, 2018

I would like to suggest a new feature.

The observable.takeUntil function provides the following two types.

- takeUntil(ObservableSource<U> other)
- takeUntil(Predicate<? super T> stopPredicate)

TakeUntil, which combines the two sources, the first function. This controls until the first item is emitted as shown below.

2018-07-26 11 15 06

The point at which takeUntil controls is when the first item is emit, not when onComplete is called.

here I thought.
'If it detects when the first item is emit, is it possible to support Single or Completable...etc as well as Observable?'

If this suggestion does not depart from the intent of takeUntil of reactiveX,
I want to make a Pull Request that adds the following function.

- takeUntil(SingleSource<U> other)
- takeUntil(MaybeSource<U> other)
- takeUntil(CompletableSource<U> other)
- takeUntil(FlowableSource<U> other)

If this goes depart from the intent, please tell me why.

Thanks!

@akarnokd
Copy link
Member

I'm not convinced we need those dedicated variants. Use the appropriate conversion method.

There is, however, an outstanding request for Completable.takeUntil(Publisher) and/or Completable.takeUntil(ObservableSource).

@JSpiner
Copy link
Author

JSpiner commented Jul 26, 2018

hmm....

For example,

Only subscribe for 10 seconds

it would be implements like

observable.takeUntil(Observable.timer(10, SECONDS))
    .subscribe(...);

Completable is enough, but should be used as Observable. And
I think there is a possibility of misrepresenting the meaning.

Of course, we can convert Completable to something like this,
but it does not look good.

observable.takeUntil(Completable.timer(10, SECONDS).toObservable())
    .subscribe(...);

@akarnokd
Copy link
Member

Then use Observable.timer() and there is no misinterpretation. If the particular source is not known exactly, use toObservable(), otherwise use the same reactive type on the until part as the main source.

@JSpiner
Copy link
Author

JSpiner commented Jul 30, 2018

Do we need to discuss for this topic?
If not, I will close the issue.

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

No branches or pull requests

2 participants