2022-12-30 00:53:43 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
2024-01-05 03:52:49 +00:00
|
|
|
fn main() {
|
2024-01-16 17:45:02 +00:00
|
|
|
launch_desktop(app);
|
2022-12-30 00:53:43 +00:00
|
|
|
}
|
|
|
|
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
|
|
|
let mut count = use_signal(|| 0);
|
2023-08-05 00:23:57 +00:00
|
|
|
|
2024-01-14 05:12:21 +00:00
|
|
|
use_future(|| async move {
|
2023-08-05 00:25:40 +00:00
|
|
|
loop {
|
2024-01-05 03:09:59 +00:00
|
|
|
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
2023-08-08 20:31:38 +00:00
|
|
|
count += 1;
|
2023-08-05 00:25:40 +00:00
|
|
|
}
|
|
|
|
});
|
2023-08-05 00:23:57 +00:00
|
|
|
|
2024-01-24 20:21:14 +00:00
|
|
|
use_effect(move || {
|
|
|
|
println!("High-Five counter: {}", count());
|
|
|
|
});
|
|
|
|
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx! {
|
2023-08-08 20:31:38 +00:00
|
|
|
div { "High-Five counter: {count}" }
|
2024-01-14 05:12:21 +00:00
|
|
|
}
|
2022-12-30 00:53:43 +00:00
|
|
|
}
|