Skip to main content

euv_ui/hook/use_keyboard/
struct.rs

1use super::*;
2
3/// Reactive state for the keyboard.
4///
5/// The handle carries the key that is currently held down and the
6/// teardown that removes the window listeners.
7///
8/// The key is a `Signal<String>`: a render closure that reads it
9/// re-renders when a key goes down or comes up, and nothing else in
10/// the tree is disturbed.
11#[derive(Clone, CustomDebug, Data)]
12pub struct UseKeyboard {
13    /// The key currently held down, empty when no key is down.
14    #[get(type(copy))]
15    pub pressed: Signal<String>,
16    /// The teardown that removes the window listeners.
17    #[get(pub(crate))]
18    #[debug(skip)]
19    pub(crate) teardown: Teardown,
20}