pub fn use_interval_fn<CbFn, N>(
callback: CbFn,
interval: N,
) -> Pausable<impl Fn() + Clone + Send + Sync, impl Fn() + Clone + Send + Sync>
Expand description
Wrapper for set_interval
with controls.
§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.