fun <T> CoroutineScope.promise((source)
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> T
Platform and version requirements: JS
Starts new coroutine and returns its result as an implementation of Promise.
Coroutine context is inherited from a CoroutineScope, additional context elements can be specified with context argument. If the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. The parent job is inherited from a CoroutineScope as well, but it can also be overridden with corresponding coroutineContext element.
By default, the coroutine is immediately scheduled for execution.
Other options can be specified via
start parameter. See CoroutineStart for details.
context - additional to CoroutineScope.coroutineContext context of the coroutine.
start - coroutine start option. The default value is CoroutineStart.DEFAULT.
block - the coroutine code.