Skip to content
Node: Promise.all, timers7 APIs

async

Package async provides Promise-like concurrency helpers with context cancellation.

import "github.com/sahilkhaire/gox/async"
## API reference

Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.

Functions

SymbolNode.jsKindSummary
AftersetTimeout(fn, d)funcAfter sends the time on the returned channel when duration elapses.
AllPromise.all([a(), b()])funcAll runs tasks concurrently and returns when all complete or ctx is cancelled.
RacePromise.race([a(), b()])funcRace runs tasks concurrently and returns the first successful result or error.
RetryfuncRetry calls fn until it succeeds or attempts are exhausted.
Sleepawait sleep(ms)funcSleep waits until duration elapses or ctx is cancelled.
TimeoutfuncTimeout runs fn with a deadline derived from ctx and timeout.

Types

SymbolNode.jsKindSummary
RetryConfigtypeRetryConfig configures Retry backoff.

MIT Licensed · Built for Node.js developers moving to Go