tick

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tick is the timer every tuilib component schedules through, and the seam tests use to stop waiting on real time.

After replaces tea.Tick in library code for one reason beyond tests: tea.Tick starts its timer when the command is created, so running the same command twice blocks forever on the second run. After starts the wait when the command runs, so a command is safe to run again.

Instant makes every After fire at once for the rest of a test — a debounce, a settle delay, a poll interval or a spinner frame no longer costs its duration. Code that feeds a timer's message straight back into Update and runs the next one should not use it: a spinner that re-arms instantly never stops.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(d time.Duration, fn func(time.Time) tea.Msg) tea.Cmd

After returns a command that waits d, then returns fn(now).

func Instant

func Instant(t Cleaner)

Instant makes every After return at once until the test ends.

Types

type Cleaner

type Cleaner interface{ Cleanup(func()) }

Cleaner is what Instant needs from a test: testing.T and testing.B are both one, without this package importing testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL