API reference / @evolu/common / Task

Task

⚡ Lazy, cancellable Promise that returns Result instead of throwing

Interfaces

InterfaceDescription
AbortErrorError returned when a Task is cancelled via AbortSignal.
MutexA mutex (mutual exclusion) that ensures only one Task runs at a time.
RetryErrorError returned when retry exhausts all retry attempts.
RetryOptionsOptions for configuring retry behavior.
SemaphoreA semaphore that limits the number of concurrent async Tasks.
TaskTask is a lazy, cancellable Promise that returns Result instead of throwing.
TaskContextContext passed to Tasks for cancellation.
TimeoutErrorError returned when timeout exceeds the specified duration.

Functions

FunctionDescription
createMutexCreates a new mutex for ensuring mutual exclusion.
createSemaphoreCreates a semaphore that limits concurrent async Tasks to the specified count.
requestIdleTaskSchedule a task to run after all interactions (animations, gestures, navigation) have completed.
retryAdds retry logic with exponential backoff and jitter to a Task.
timeoutAdds timeout behavior to a Task.
toTaskConverts async function returning Result to a Task.
waitCreates a Task that waits for the specified duration.

Was this page helpful?