edge_frame/
util.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use web_sys::{Event, HtmlInputElement};
use yew::TargetCast;

pub fn if_true(cond: bool, s: &str) -> &str {
    if cond {
        s
    } else {
        ""
    }
}

pub fn get_input_text(event: Event) -> String {
    event.target_unchecked_into::<HtmlInputElement>().value()
}

pub fn get_input_checked(event: Event) -> bool {
    event.target_unchecked_into::<HtmlInputElement>().checked()
}