Function use_interval_fn

Source
pub fn use_interval_fn<CbFn, N>(
    callback: CbFn,
    interval: N,
) -> Pausable<impl Fn() + Clone + Send + Sync, impl Fn() + Clone + Send + Sync>
where CbFn: Fn() + Clone + 'static, N: Into<Signal<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,
);

§SendWrapped Return

The returned closures pause and resume are sendwrapped functions. They can only be called from the same thread that called use_interval_fn.

§Server-Side Rendering

On the server this function will simply be ignored.