Skip to main content

⏳ Async Operations

Module: async/* | Operators: 8

Control timing with delays, debouncing, retries, and timeouts.


Operator Reference

async/delay

Delay · 1 argument · returns void · ⚠️ has side effects

Wait for specified milliseconds

ParameterTypeDescription
msnumberMilliseconds to wait
["async/delay", 2000] // Wait 2 seconds

async/timeout

Timeout · 2 arguments · returns any · ⚠️ has side effects

Add timeout to an effect

ParameterTypeDescription
effectexpressionEffect to execute
msnumberTimeout in milliseconds
["async/timeout", ["call", "api", "fetchData"], 5000]

async/debounce

Debounce · 2 arguments · returns void · ⚠️ has side effects

Debounce an event (wait for pause in events)

ParameterTypeDescription
eventstringEvent name to emit
msnumberDebounce delay in milliseconds
["async/debounce", "SEARCH", 300]

async/throttle

Throttle · 2 arguments · returns void · ⚠️ has side effects

Throttle an event (emit at most once per interval)

ParameterTypeDescription
eventstringEvent name to emit
msnumberThrottle interval in milliseconds
["async/throttle", "SCROLL", 100]

async/retry

Retry · 2 arguments · returns any · ⚠️ has side effects

Retry an effect with configurable backoff

ParameterTypeDescription
effectexpressionEffect to retry
optsobject{ attempts, backoff, baseDelay }
["async/retry",
["call", "api", "fetchData", { "id": "@entity.id" }],
{ "attempts": 3, "backoff": "exponential", "baseDelay": 1000 }]

async/race

Race · 2 or more · returns any · ⚠️ has side effects

Execute effects in parallel, return first to complete

ParameterTypeDescription
...effectsexpression[]Effects to race
["async/race", ["call", "api1"], ["call", "api2"]]

async/all

All · 2 or more · returns array · ⚠️ has side effects

Execute effects in parallel, wait for all to complete

ParameterTypeDescription
...effectsexpression[]Effects to execute
["async/all", ["call", "api1"], ["call", "api2"]]

async/sequence

Sequence · 2 or more · returns array · ⚠️ has side effects

Execute effects in sequence (one after another)

ParameterTypeDescription
...effectsexpression[]Effects to execute in order
["async/sequence", ["call", "validate"], ["call", "save"]]