Readonly
dataThe data of the fiber, used to store and swap data between fiber and the controller.
Readonly
signalThe abort signal of the fiber, used to abort the execution of the fiber.
This signal object could be passed to all other asynchronous functions that
accepting an AbortSignal
in the parameters.
Only work if the fiber listens to the signal.
The fiber execution could call this method and wait for the controller to resume (or abort) it. This is useful when the fiber execution has nothing to do for a while, something like fiber-pooling management.
The fiber execution should always pause itself by waiting for the promise. And if the promise is rejected, the fiber must quit its execution.
The context of the fiber execution, used to exchanged data between the fiber and the controller. It also provides the abort signal to the fiber execution, so that the fiber can be aborted by the controller. Besides, it provides a
sleep
method to pause the fiber execution and wait for the controller to resume it.