Joe
02/05/2020, 7:41 PMclass CoroutineJob {
suspend fun doWork() {
// do stuff in coroutine context
}
}
// elsewhere:
scope.launch {
CoroutineJob().doWork()
)
or
class CoroutineJob(val scope: CoroutineScope) {
fun launchWork() {
scope.launch {
// do stuff in coroutine context (possibly calling another suspend fun member?)
}
}
}
// elsewhere:
CoroutineJob(scope).launchWork()
or something else?bdawg.io
02/05/2020, 8:34 PMEvan R.
02/06/2020, 10:31 PMlaunch { CoroutineJob().doWork() }
bdawg.io
02/07/2020, 4:33 PMval myClass = CoroutineJob()
retry(maxAttempts=10) {
myClass.doWork()
}