Created
August 19, 2022 19:10
-
-
Save nasserkhosravi/296bebbb46596d812dd0ad3b481c437f to your computer and use it in GitHub Desktop.
Interfacing Rx Schedulers
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
import io.reactivex.Scheduler | |
import io.reactivex.android.schedulers.AndroidSchedulers | |
import io.reactivex.schedulers.Schedulers | |
class DefaultSchedulerProvider : SchedulerProvider { | |
override fun io(): Scheduler = Schedulers.io() | |
override fun ui(): Scheduler = AndroidSchedulers.mainThread() | |
override fun computation(): Scheduler = Schedulers.computation() | |
override fun trampoline(): Scheduler = Schedulers.trampoline() | |
override fun newThread(): Scheduler = Schedulers.newThread() | |
} | |
interface SchedulerProvider { | |
fun io(): Scheduler | |
fun ui(): Scheduler | |
fun computation(): Scheduler | |
fun trampoline(): Scheduler | |
fun newThread(): Scheduler | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment