Last active
September 9, 2021 17:43
-
-
Save ericntd/1f1cd536fe05c8859d47a8f328d0bdbb 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
val inputSubject = PublishSubject.create<String>() // immutable! | |
val inputSubjectReadOnly = inputSubject.debounce(500L, TimeUnit.MILLISECONDS) | |
val someViewModel = SomeViewModel(inputSubjectReadOnly, ...) | |
override fun onSomeButtonClicked(...) { | |
// process success/ failure, extract data | |
inputSubject.onNext(data) // emit to input stream ViewModel consumes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment