android10 / android10/Android-CleanArchitecture-Kotlin

Asynchronous approach for UseCase execute function

Abierto
#31 3 comentarios 2 reacciones 0 asignados Ver en GitHub
discussion
Lenguaje dominante
Kotlin
Estrellas
4.8k
Forks
929
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi,
Currently I found that You do it this way
```
val job = async(CommonPool) { run(params) }
launch(UI) { onResult.invoke(job.await()) }
```
Can we just create one coroutine here and just do context switching to execute the UI block code, maybe something like this
```
launch(CommonPool + job) {
val result = async(coroutineContext) { run(params) }
withContext(UI) { onResult.invoke(result.await()) }
}
```
And the ```job``` on this sample is a private property for cancellation purpose.

By the way, thank you so much for always providing us with such an awesome resources. 👍 🙇

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.