Function leptos_use::use_interval_fn

source ·
pub fn use_interval_fn<CbFn, N>(
    callback: CbFn,
    interval: N,
) -> Pausable<impl Fn() + Clone, impl Fn() + Clone>
where CbFn: Fn() + Clone + 'static, N: Into<MaybeSignal<u64>>,
Expand description

Wrapper for set_interval with controls.

§Demo

Link to Demo

§Usage

let Pausable { pause, resume, is_active } = use_interval_fn(
    || {
        // do something
    },
    1000,
);

§Server-Side Rendering

On the server this function will simply be ignored.