package cn.dankal.basiclib.base.lifecycle;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;

public class LifecycleTransformer<T> implements ObservableTransformer<T,T> {

    private Observable<T> observable;

    public LifecycleTransformer(Observable<T> observable) {
        this.observable = observable;
    }

    @Override
    public ObservableSource<T> apply(Observable<T> upstream) {
        return upstream.takeUntil(observable);
    }
}
