Skip to content
Node: setTimeout(fn, d)github.com/sahilkhaire/gox/async

After

Overview ​

After sends the time on the returned channel when duration elapses.

If you are coming from Node.js, the closest pattern is setTimeout(fn, d).

Signature ​

go
func After(d time.Duration) <-chan time.Time

Compare: Node.js · Standard Go · gox ​

js
setTimeout(fn, d)
go
// Use the underlying stdlib or driver directly.
// See package overview for escape hatches.
go
import "github.com/sahilkhaire/gox/async"

async.After(ctx, d, fn)

Example ​

go
import "github.com/sahilkhaire/gox/async"

async.After(ctx, d, fn)

Tips ​

All async helpers respect context cancellation — prefer them over raw goroutines when you need timeouts.

Standard library alternative ​

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

← Back to async package overview

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