arocnies
12/01/2017, 4:31 AMrunBlocking {...}
for Kotlin/JS? launch {...}
is relatively straight forward but I just can't seem to figure out how to properly block for a coroutine in JS.gildor
12/01/2017, 5:17 AMpdvrieze
12/01/2017, 10:05 AMrunBlocking
doesn't do what you may think it does. It runs everything (except subcoroutines) on the same thread (the one that started it). In some ways this fits well with Javascript.
You cannot actually wait for a coroutine completion in Javascript. What you do is use a callback on completion. Waiting for a coroutine amounts to either inside the coroutine just doing what you want with the result or starting a new coroutine that invokes await on the previous one.gildor
12/01/2017, 10:26 AM