Added extensions 'emitAfter()' to main RxJava types

This commit is contained in:
Daniil Borisovskii 2020-04-27 11:18:02 +03:00
parent fa759e60cc
commit 4597623cbf
4 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package ru.touchin.extensions.rx
import io.reactivex.Completable
import io.reactivex.Flowable
fun <T> Flowable<T>.emitAfter(other: Completable): Flowable<T> = this.flatMap { value ->
other.andThen(Flowable.just(value))
}

View File

@ -0,0 +1,8 @@
package ru.touchin.extensions.rx
import io.reactivex.Completable
import io.reactivex.Maybe
fun <T> Maybe<T>.emitAfter(other: Completable): Maybe<T> = this.flatMap { value ->
other.andThen(Maybe.just(value))
}

View File

@ -0,0 +1,8 @@
package ru.touchin.extensions.rx
import io.reactivex.Completable
import io.reactivex.Observable
fun <T> Observable<T>.emitAfter(other: Completable): Observable<T> = this.flatMap { value ->
other.andThen(Observable.just(value))
}

View File

@ -0,0 +1,8 @@
package ru.touchin.extensions.rx
import io.reactivex.Completable
import io.reactivex.Single
fun <T> Single<T>.emitAfter(other: Completable): Single<T> = this.flatMap { value ->
other.andThen(Single.just(value))
}