API reference / @evolu/common / Task

Task

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 function that creates and returns an optionally cancellable Promise using Result.
TaskContextContext passed to Tasks for cancellation.
TimeoutErrorError returned when timeout exceeds the specified duration.

Type Aliases

Type AliasDescription
MaybeAsyncRepresents a value that can be either synchronous or asynchronous.

Functions

FunctionDescription
createMutexCreates a new mutex for ensuring mutual exclusion.
createSemaphoreCreates a semaphore that limits concurrent async Tasks to the specified count.
isAsyncType guard to check if a MaybeAsync value is async (a promise).
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?