Optional
groupReadonly
idOptional
resultAttaches callbacks for the resolution and/or rejection of the Promise.
Optional
handle: ((value) => U | PromiseLike<U>)The callback to execute when the Promise is resolved.
Optional
onrejected: ((error) => G | PromiseLike<G>)The callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
Generated using TypeDoc
Task is a unit of computation that runs concurrently, a light-weight process (in Erlang terms). You can spawn bunch of them and provided cooperative scheduler will interleave their execution.
Tasks have three type variables first two describing result of the computation
Success
that corresponds to return type andFailure
describing an error type (caused by thrown exceptions). Third type varibaleMessage
describes type of messages this task may produce.Please note that that TS does not really check exceptions so
Failure
type can not be guaranteed. Yet, we find them more practical that omitting them as TS does forPromise
types.Our tasks are generators (not the generator functions, but what you get invoking them) that are executed by (library provided) provided scheduler. Scheduler recognizes two special
Control
instructions yield by generator. When scheduler getscontext
instruction it will resume generator with a handle that can be used to resume running generator after it is suspended. Whensuspend
instruction is received scheduler will suspend execution until it is resumed by queueing it from the outside event.