ahulyk
11/19/2019, 9:58 AMghedeon
11/19/2019, 10:41 AMahulyk
11/19/2019, 10:58 AMghedeon
11/19/2019, 11:42 AMsergio250
11/19/2019, 11:46 AMibraiz_teamo
11/19/2019, 12:21 PMabstract class SuspendUseCase<out Type, in Params> where Type : Any {
abstract suspend fun run(params: Params): Either<Failure, Type>
operator fun invoke(scope: CoroutineScope, params: Params, onResult: (Either<Failure, Type>) -> Unit = {}) {
val job = scope.async { run(params) }
scope.launch(Dispatchers.Main) { onResult(job.await()) }
}
class None
}
how can this be furthered improved? Or there should be different suspend usecase classes for IO, Compute and non-blocking usecases?ahulyk
11/19/2019, 1:32 PMursus
11/19/2019, 1:57 PMghedeon
11/19/2019, 2:00 PMursus
11/19/2019, 2:17 PMghedeon
11/19/2019, 3:41 PMusecase() -> foo.bar()
where bar
is called on whatever scope was injected into foo
.ghedeon
11/19/2019, 3:44 PMCoroutineScope().launch{}
inside of suspend function (just not structured in this case).ursus
11/19/2019, 3:49 PMgildor
11/19/2019, 11:34 PMursus
11/19/2019, 11:35 PMgildor
11/22/2019, 2:36 PMursus
11/22/2019, 5:09 PMursus
11/22/2019, 5:10 PMgildor
11/22/2019, 5:15 PMursus
11/22/2019, 5:18 PMgildor
11/23/2019, 2:38 AM