cooperate
Functions
cooperate()
cooperate<
T>(callback,signal?):CooperationPromise<T>
Executes a function cooperatively, allowing it to hand off control to the next cooperative function.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | void |
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (handoff) => Promise<T> | The callback function to execute cooperatively. |
signal? | AbortSignal | - |
Returns
CooperationPromise<T>
A promise that resolves when the cooperation is complete.
Defined in
getCurrentCooperation()
getCurrentCooperation():
object
Gets the current cooperation.
Returns
object
A tuple containing the cooperation ID and the time when the cooperation started.
initiator
initiator:
Symbol
startedAt
startedAt:
number
Throws
An error if no cooperation is in progress.