beamtea_stopwatch (beamtea v0.1.2)
View SourceA bubble: a count-up stopwatch, mirroring the stopwatch package in charmbracelet/bubbles.
Self-ticking like beamtea_timer. Start it, forward messages to update/2, and read elapsed_ms/1.
Summary
Functions
Options: interval_ms (tick granularity, default 100).
Reset the elapsed time to zero (keeps running state).
Start (or resume); returns the command scheduling the first tick.
Pause/resume.
Advance on its own tick; ignore other messages.
Render elapsed time as MM:SS.CS.
Types
Functions
-spec elapsed_ms(model()) -> non_neg_integer().
-spec new() -> model().
Equivalent to new(#{}).
Options: interval_ms (tick granularity, default 100).
Reset the elapsed time to zero (keeps running state).
-spec start(model()) -> beamtea:cmd().
Start (or resume); returns the command scheduling the first tick.
-spec toggle(model()) -> {model(), beamtea:cmd()}.
Pause/resume.
-spec update(term(), model()) -> {model(), beamtea:cmd()}.
Advance on its own tick; ignore other messages.
Render elapsed time as MM:SS.CS.