Readonly
annotationsThe map of annotations associated with the executor.
Readonly
invalidatedThe timestamp when the executor was invalidated, or 0 if the executor isn't invalidated.
Readonly
istrue
if the executor was activated more times then deactivated.
Readonly
istrue
if the executor was fulfilled with a value, or false
otherwise.
Readonly
istrue
if invalidate was called on a settled executor and a new settlement hasn't
occurred yet.
Readonly
istrue
if the execution is currently pending, or false
otherwise.
Readonly
istrue
if the executor was rejected with a reason, or false
otherwise.
Readonly
isReadonly
keyThe key of this executor, unique in scope of the Executor.manager.
Readonly
managerThe manager that created the executor.
Readonly
pendingThe promise of the pending task execution, or null
if there's no pending task execution.
Note: This promise is aborted if the task is replaced. Use getOrAwait to wait until the executor becomes settled.
Readonly
reasonThe reason of the latest failure.
Note: An executor may still have a rejection reason even if it was fulfilled. Check isRejected to ensure that an executor is actually rejected.
Readonly
settledThe timestamp when the executor was settled, or 0 if it isn't settled.
Readonly
taskThe latest task that was executed, or null
if the executor didn't execute any tasks.
Readonly
valueThe value of the latest fulfillment.
Note: An executor may still have value even if it was rejected. Use get, getOrDefault, or getOrAwait to retrieve a value of the fulfilled executor.
Readonly
versionThe integer version of the state of this executor that is incremented every time the executor is mutated.
Instantly aborts pending execution and preserves available results as is. Value (or error) returned from pending task callback is ignored. The signal passed to the executed task callback is aborted.
Optional
reason: unknownThe abort reason that is used for rejection of the pending task promise.
Marks the executor as being actively monitored by an external consumer.
Activated executor stays active until all returned deactivate callbacks are invoked.
The callback that deactivates the executor if there are no more active consumers.
Assigns patch to existing annotations.
The patch containing new annotations.
Clears available results and doesn't affect the pending task execution.
The latest task can still be retried after the executor is cleared.
Executes a task and populates the executor with the returned result.
Instantly aborts pending execution (if any), marks the executor as pending and then invokes the task callback.
If a new task is executed before the returned promise is fulfilled then the signal is aborted and the result is ignored.
The task callback that returns the new result for the executor to store.
The promise that is resolved with the result of the task.
Waits for the executor to become settled and non-pending. Then, the returned promise is resolved with a value if the executor is fulfilled, or rejected with a reason if the executor is rejected.
If the executor is detached during this operation, then the returned promise is rejected with the AbortError.
The default value.
If the executor is settled the result is masted as invalidated.
Optional
invalidatedAt: numberThe timestamp when the executor result was invalidated.
Publishes the event for subscribers of the executor and its manager.
The type of the published event.
Optional
payload: PayloadThe optional payload associated with the event.
If the executor isn't pending then the latest task is executed again. If there's no task then no-op.
Subscribes the listener to changes of the observed value.
The listener to subscribe.
Returns the serializable executor state.
Manages the async task execution process and provides ways to access execution results, abort or replace a task execution, and subscribe to an execution state changes.