[英]Call a coroutine using RxJava without a scope
I would like to know how I can call a coroutine using RxJava and without using any scope.我想知道如何使用 RxJava 调用协程而不使用任何 scope。
If I have如果我有
suspend fun fetchInfo() {
//some code here
}
Thanks谢谢
Using rxSingle
, rxObservable
function使用
rxSingle
, rxObservable
function
import kotlinx.coroutines.rx3.rxObservable
import kotlinx.coroutines.rx3.rxSingle
rxSingle { fetchInfo() }
rxObservable { send(fetchInfo()) }
https://github.com/hoc081098/ComicReaderApp_MVI_Coroutine_RxKotlin_Jetpack/blob/f4e89036b934f8233d6d6ded941b19b702467405/app/src/main/java/com/hoc/comicapp/data/repository/ComicRepository1Impl.kt#L27 https://github.com/hoc081098/ComicReaderApp_MVI_Coroutine_RxKotlin_Jetpack/blob/f4e89036b934f8233d6d6ded941b19b702467405/app/src/main/java/com/hoc/comicapp/data/repositoryImpl27.ComicRepository#
https://github.com/hoc081098/ComicReaderApp_MVI_Coroutine_RxKotlin_Jetpack/blob/f4e89036b934f8233d6d6ded941b19b702467405/app/src/main/java/com/hoc/comicapp/ui/search_comic/SearchComicInteractorImpl.kt#L20 https://github.com/hoc081098/ComicReaderApp_MVI_Coroutine_RxKotlin_Jetpack/blob/f4e89036b934f8233d6d6ded941b19b702467405/app/src/main/java/com/hoc/comicapp/ui/search_comictact/SearchIntermic0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.