API reference / @evolu/common / Task
Task
⚡ Lazy, cancellable Promise that returns Result instead of throwing
Interfaces
| Interface | Description |
|---|---|
| AbortError | Error returned when a Task is cancelled via AbortSignal. |
| Mutex | A mutex (mutual exclusion) that ensures only one Task runs at a time. |
| RetryError | Error returned when retry exhausts all retry attempts. |
| RetryOptions | Options for configuring retry behavior. |
| Semaphore | A semaphore that limits the number of concurrent async Tasks. |
| Task | Task is a lazy, cancellable Promise that returns Result instead of throwing. |
| TaskContext | Context passed to Tasks for cancellation. |
| TimeoutError | Error returned when timeout exceeds the specified duration. |
Functions
| Function | Description |
|---|---|
| createMutex | Creates a new mutex for ensuring mutual exclusion. |
| createSemaphore | Creates a semaphore that limits concurrent async Tasks to the specified count. |
| requestIdleTask | Schedule a task to run after all interactions (animations, gestures, navigation) have completed. |
| retry | Adds retry logic with exponential backoff and jitter to a Task. |
| timeout | Adds timeout behavior to a Task. |
| toTask | Converts async function returning Result to a Task. |
| wait | Creates a Task that waits for the specified duration. |