tick

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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