euv_ui/hook/use_window_size/struct.rs
1use super::*;
2
3/// Reactive state for the window's size.
4///
5/// The handle carries the viewport's width and height and the teardown
6/// that removes the window listener.
7///
8/// The size is a `Signal<i32>`: a render closure that reads it
9/// re-renders when the window is resized.
10#[derive(Clone, CustomDebug, Data)]
11pub struct UseWindowSize {
12 /// The viewport width in CSS pixels.
13 #[get(type(copy))]
14 pub width: Signal<i32>,
15 /// The viewport height in CSS pixels.
16 #[get(type(copy))]
17 pub height: Signal<i32>,
18 /// The teardown that removes the window listener.
19 #[get(pub(crate))]
20 #[debug(skip)]
21 pub(crate) teardown: Teardown,
22}