Skip to main content

euv_ui/hook/use_online_status/
struct.rs

1use super::*;
2
3/// Reactive state for the browser's online status.
4///
5/// The handle carries the current answer and the teardown that removes
6/// the `online` / `offline` listeners from the window.
7///
8/// The answer is a `Signal<bool>`: a render closure that reads it
9/// re-renders when the connection state changes.
10#[derive(Clone, CustomDebug, Data)]
11pub struct UseOnlineStatus {
12    /// Whether the browser believes it is online.
13    #[get(type(copy))]
14    pub online: Signal<bool>,
15    /// The teardown that removes the window listeners.
16    #[get(pub(crate))]
17    #[debug(skip)]
18    pub(crate) teardown: Teardown,
19}