RxLifecycle:
基于第二个事件流(生命周期)来帮助我们自动完成一个序列(sequence)
Usage
You must start with an Observable<T>
representing a lifecycle stream. Then you use RxLifecycle
to bind
a sequence to that lifecycle.
You can bind when the lifecycle emits anything:
1 | myObservable |
Or you can bind to when a specific lifecyle event occurs:
1 | myObservable |
Alternatively, you can let RxLifecycle determine the appropriate time to end the sequence:
1 | myObservable |
It assumes you want to end the sequence in the opposing lifecycle event - e.g., if subscribing during START
, it will
terminate on STOP
. If you subscribe after PAUSE
, it will terminate at the next destruction event (e.g.,PAUSE
will terminate in STOP
).