Skip to content

Instantly share code, notes, and snippets.

@enq3
Created October 9, 2017 10:43
Show Gist options
  • Save enq3/c617eac125636ae30ddd8b8b50a34f5c to your computer and use it in GitHub Desktop.
Save enq3/c617eac125636ae30ddd8b8b50a34f5c to your computer and use it in GitHub Desktop.
public class LocalRxBus {
private static LocalRxBus instance;
private PublishSubject<Object> subject = PublishSubject.create();
public static LocalRxBus instance() {
if (instance == null) {
instance = new LocalRxBus();
}
return instance;
}
public void setObject(Object object) {
subject.onNext(object);
subject.onComplete();
}
public Observable<Object> getObject() {
return subject;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment