1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use stdweb::Value;
#[allow(unused_imports)]
use stdweb::{_js_impl, js};
#[derive(Default, Debug)]
pub struct DialogService {}
impl DialogService {
pub fn new() -> Self {
Self {}
}
pub fn alert(&mut self, message: &str) {
js! { @(no_return) alert(@{message}); }
}
pub fn confirm(&mut self, message: &str) -> bool {
let value: Value = js! { return confirm(@{message}); };
match value {
Value::Bool(result) => result,
_ => false,
}
}
}