Created
July 8, 2017 02:24
-
-
Save hkusu/aa56c1b3bbe39f170c5aefaf7ea66404 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.hkusu.sample.android.lib.rx; | |
import rx.Observable; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
import rx.subjects.Subject; | |
public class Event<T> { | |
private final Subject<T, T> subject = new SerializedSubject<>(PublishSubject.create()); | |
public Observable<T> observable() { | |
return subject; | |
} | |
public void post(T t) { | |
subject.onNext(t); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment