Function leptos_use::use_timeout_fn

source ·
pub fn use_timeout_fn<CbFn, Arg, D>(
    callback: CbFn,
    delay: D
) -> UseTimeoutFnReturn<impl Fn(Arg) + Clone, Arg, impl Fn() + Clone>
where CbFn: Fn(Arg) + Clone + 'static, Arg: 'static, D: Into<MaybeSignal<f64>>,
Expand description

Wrapper for setTimeout with controls.

§Demo

Link to Demo

§Usage

let UseTimeoutFnReturn { start, stop, is_pending, .. } = use_timeout_fn(
    |i: i32| {
        // do sth
    },
    3000.0
);

start(3);