euv_ui/hook/use_timer/struct.rs
1use super::*;
2
3/// Reactive state for a repeating timer.
4///
5/// The handle carries the number of ticks that have fired and the
6/// period they fire at.
7///
8/// The tick count is a `Signal<u64>`: a render closure that reads it
9/// re-renders on every tick, and nothing else in the tree is disturbed.
10///
11/// The interval is owned by the framework and is cleared when the
12/// component unmounts, so a timer cannot outlive its owner.
13#[derive(Clone, CustomDebug, Data)]
14pub struct UseTimer {
15 /// How many times the timer has fired.
16 #[get(type(copy))]
17 pub ticks: Signal<u64>,
18 /// The period in milliseconds.
19 #[get(type(copy))]
20 pub interval_ms: u32,
21}