Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class MainPresenter(private val view: MainView,
private val dataProvider: DataProviderAPI
private val uiContext: CoroutineContext = UI,
private val ioContext: CoroutineContext = CommonPool) {
private fun loadData() = launch(uiContext) { // use the provided uiContext (UI)
// use the provided ioContext (CommonPool)
val task = async(bgContext) { dataProvider.loadData("Task") }
val result = task.await()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment