Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final class RxBus {
- private static RxBus instance;
- private RxBus() {
- }
- public static synchronized RxBus getInstance() {
- if (instance == null) {
- instance = new RxBus();
- }
- return instance;
- }
- private final PublishProcessor<Object> bus = PublishProcessor.create();
- public void send(final Object event) {
- bus.onNext(event);
- }
- public <T> Flowable<T> event(Class<T> classz) {
- return bus.ofType(classz);
- }
- public Flowable<Object> toObservable() {
- return bus;
- }
- }
Add Comment
Please, Sign In to add comment