tree: 8f0dbb3fa8139d3c78afa9a5775c88bc6e1c12e5 [path history] [tgz]
  1. npm/
  2. src/
  3. build.gradle
  4. README.md
js/kotlinx-coroutines-core-js/README.md

Module kotlinx-coroutines-core-js

Core primitives to work with coroutines on Kotlin/JS.

Coroutine builder functions:

NameResultScopeDescription
launchJobCoroutineScopeLaunches coroutine that does not have any result
asyncDeferredCoroutineScopeReturns a single value with the future result

Coroutine dispatchers implementing CoroutineDispatcher:

NameDescription
DefaultDispatcherPosts execution to JS event loop
UnconfinedDoes not confine coroutine execution in any way

More context elements:

NameDescription
NonCancellableA non-cancelable job that is always active
CoroutineExceptionHandlerHandler for uncaught exception

Top-level suspending functions:

NameDescription
delayNon-blocking sleep
yieldYields thread in single-threaded dispatchers
withContextSwitches to a different context
withTimeoutSet execution time-limit with exception on timeout
withTimeoutOrNullSet execution time-limit will null result on timeout

Cancellation support for user-defined suspending functions is available with suspendCancellableCoroutine helper function. NonCancellable job object is provided to suppress cancellation with run(NonCancellable) {...} block of code.

Package kotlinx.coroutines.experimental

General-purpose coroutine builders, contexts, and helper functions.