Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RxBus private constructor() {
- private val subject = PublishSubject.create<Any>()
- fun publish(message: Any) {
- subject.onNext(message)
- }
- fun subscribe(action: (Any) -> Unit): Disposable {
- return subject.subscribe { action(it) }
- }
- companion object {
- val instance by lazy { RxBus() }
- }
- }
Add Comment
Please, Sign In to add comment