leptos_use_bh/utils/pausable.rs
1use leptos::reactive::wrappers::read::Signal;
2
3/// Pausable effect
4#[derive(Clone)]
5pub struct Pausable<PauseFn, ResumeFn>
6where
7 PauseFn: Fn() + Clone + Send + Sync,
8 ResumeFn: Fn() + Clone + Send + Sync,
9{
10 /// A Signal that indicates whether a pausable instance is active. `false` when paused.
11 pub is_active: Signal<bool>,
12
13 /// Temporarily pause the effect from executing
14 pub pause: PauseFn,
15
16 /// Resume the effect
17 pub resume: ResumeFn,
18}