Dominaezzz
08/26/2019, 3:41 PMkotlinx-coroutines
to expose an Async<T>
type alias? That'll resolve to Promise<T>
in JS, CompletableFuture<T>
in Java8, ListenableFuture<T>
on Android and Deferred<T>
on Native. (Basically an appropriate async type for each platform that can be easily consumed from their respective languages). Then a GlobalScope.platformAsync
or something to go along with it. I find myself needing to do this already since suspension only works within Kotlin itself and not from Java, JS or Obj-C.louiscad
08/26/2019, 4:11 PMJob
) is not included in these platform or library specific primitives.
You can still do it yourself, and add the extra features like cancellation if you need them.Dominaezzz
08/26/2019, 4:17 PMDominaezzz
08/26/2019, 4:18 PMlouiscad
08/26/2019, 4:18 PMDominaezzz
08/26/2019, 4:19 PMlouiscad
08/26/2019, 4:21 PMlouiscad
08/26/2019, 4:22 PMDominaezzz
08/26/2019, 4:25 PM