use_interval_fn
Wrapper for set_interval
with controls.
Demo
Usage
use leptos::prelude::*;
use leptos_use::use_interval_fn;
use leptos_use::utils::Pausable;
#[component]
fn Demo() -> impl IntoView {
let Pausable { pause, resume, is_active } = use_interval_fn(
|| {
// do something
},
1000,
);
view! { }
}
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.
Feature
This function is only available if the crate feature
use_interval_fn
is enabled