leptos_use/utils/
pausable.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use leptos::Signal;

/// Pausable effect
pub struct Pausable<PauseFn, ResumeFn>
where
    PauseFn: Fn() + Clone,
    ResumeFn: Fn() + Clone,
{
    /// A Signal that indicates whether a pausable instance is active. `false` when paused.
    pub is_active: Signal<bool>,

    /// Temporarily pause the effect from executing
    pub pause: PauseFn,

    /// Resume the effect
    pub resume: ResumeFn,
}