pub fn use_stopwatch(
started_at_ms: i64,
ended_at_ms: Option<i64>,
) -> Signal<i64>Expand description
Stopwatch hook — counts up from a start time.
Returns a signal with the elapsed seconds. Ticks every second via
wall-clock diff. Automatically stops ticking when ended_at_ms is provided.
§Parameters
started_at_ms: Epoch milliseconds when the stopwatch started.ended_at_ms: Epoch milliseconds when it ended (None= still running).
§Example
ⓘ
let started = dioxus_nox_timer::time::now_ms(); // capture start time
let elapsed = use_stopwatch(started, None); // None = still running
rsx! {
p { "Elapsed: {format_duration(*elapsed.read())}" }
}