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
Successthat corresponds to return type andFailuredescribing an error type (caused by thrown exceptions). Third type varibaleMessagedescribes type of messages this task may produce.Please note that that TS does not really check exceptions so
Failuretype can not be guaranteed. Yet, we find them more practical that omitting them as TS does forPromisetypes.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
Controlinstructions yield by generator. When scheduler getscontextinstruction it will resume generator with a handle that can be used to resume running generator after it is suspended. Whensuspendinstruction is received scheduler will suspend execution until it is resumed by queueing it from the outside event.