leptos_use_interval/options.rs
1use default_struct_builder::DefaultBuilder;
2use std::rc::Rc;
3
4/// Options for [`use_interval_with_options`](crate::use_interval_with_options)
5#[derive(DefaultBuilder)]
6pub struct UseIntervalOptions {
7 /// Start the timer immediately. Defaults to `true`.
8 pub(crate) immediate: bool,
9
10 /// Callback on every interval.
11 pub(crate) callback: Rc<dyn Fn(u64)>,
12}
13
14impl Default for UseIntervalOptions {
15 fn default() -> Self {
16 Self {
17 immediate: true,
18 callback: Rc::new(|_: u64| {}),
19 }
20 }
21}