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

how to do a bindUntil ? #72

Closed
ghost opened this issue Jul 2, 2017 · 7 comments
Closed

how to do a bindUntil ? #72

ghost opened this issue Jul 2, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Jul 2, 2017

Corresponding events works well , but how can i do a bindUntil just like rxLife ?

@ZacSweers
Copy link
Collaborator

Can you be more specific? If you have a traditional stream of lifecycle events, you can simulate something like a "bindUntil" by just doing something like this:

myObservable
    .to(new ObservableScoper<>(lifecycleEvents
        .filter(...)
        .firstElement())
    .subscribe();

@ghost
Copy link
Author

ghost commented Jul 4, 2017

@h2rashee lifecycleEvents? is that a Maybe ?

@ZacSweers
Copy link
Collaborator

lifecycle events could be an observable, calling firstElement() returns a Maybe and you'd filter on whatever event you're looking for

@ghost
Copy link
Author

ghost commented Jul 4, 2017

@hzsweers In my case , LifeScopeProvider is an Acitivyt and lifecycle() method returns a BehaviorSubject.

myObservable
    .to(new ObservableScoper<>(lifecycle()
        .filter(...)
        .firstElement())
    .subscribe();

the BehaviorSubject call onNext() to send a lifecycleEvent in every Activity lifecycle callback method like onPause()

But the filter() is not called !

@ZacSweers
Copy link
Collaborator

do you have sample code? It's difficult to help from that snippet alone

@h2rashee
Copy link

h2rashee commented Jul 4, 2017

@blackberry2016 Am I missing how I'm involved in this ticket?

@ghost
Copy link
Author

ghost commented Jul 15, 2017

@hzsweers it works.

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

No branches or pull requests

2 participants