https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

Samer Hobeika

05/07/2019, 6:49 PM
i’m thinking of this:
Copy code
GlobalScope.async {
  CallA() {
  if (it.success) {
   GlobalScope.async { CallB( it.value) }
 else { LogError() }
} }
😱 2
b

bdawg.io

05/07/2019, 7:39 PM
Is this an Android app… or?
s

Samer Hobeika

05/07/2019, 7:42 PM
yes
d

Dico

05/08/2019, 9:17 PM
Copy code
kotlin
val myScope = CoroutineScope(Dispatchers.Main + SupervisorJob())


// in some func
myScope.launch {
    val result = withContext(Dispatchers.Default) {
        // async computation
        CallA()
    }
    // back on main thread
    CallB(result)
}