MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / UseAfter

Function UseAfter

tsunami/app/hooks.go:211–223  ·  view source on GitHub ↗

UseAfter manages a timeout lifecycle within a component. It creates a timer that calls the provided function after the specified duration. The timer is automatically canceled on dependency changes or component unmount. This hook must be called within a component context.

(duration time.Duration, timeoutFn func(), deps []any)

Source from the content-addressed store, hash-verified

209// The timer is automatically canceled on dependency changes or component unmount.
210// This hook must be called within a component context.
211func UseAfter(duration time.Duration, timeoutFn func(), deps []any) {
212 UseGoRoutine(func(ctx context.Context) {
213 timer := time.NewTimer(duration)
214 defer timer.Stop()
215
216 select {
217 case <-ctx.Done():
218 return
219 case <-timer.C:
220 timeoutFn()
221 }
222 }, deps)
223}
224
225// ModalConfig contains all configuration options for modals
226type ModalConfig struct {

Callers

nothing calls this directly

Calls 2

UseGoRoutineFunction · 0.85
StopMethod · 0.65

Tested by

no test coverage detected