Skip to content

Instantly share code, notes, and snippets.

View k-kagurazaka's full-sized avatar

Keita Kagurazaka k-kagurazaka

  • Tokyo
View GitHub Profile
@k-kagurazaka
k-kagurazaka / Main.kt
Last active December 20, 2017 01:35
RxCommand with double context extension pattern
interface HasDisposables {
fun Disposable.autoDispose()
fun dispose()
companion object {
operator fun invoke(): HasDisposables = object : HasDisposables {
private val disposables = CompositeDisposable()
@k-kagurazaka
k-kagurazaka / DebounceTest.kt
Created December 1, 2017 14:18
RxJava debounce like operator implementation for kotlin coroutine
launch(UI) {
editText.onTextChanged()
.debounce(1, TimeUnit.SECONDS)
.consumeEach {
Log.d("DebounceTest", "value: $it")
}
}
}
fun EditText.onTextChanged(): ReceiveChannel<String> =