2023-10-17 19:45:37 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
2024-01-31 02:42:36 +00:00
|
|
|
fn main() {
|
|
|
|
launch_desktop(app);
|
|
|
|
}
|
|
|
|
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
2024-01-19 00:27:43 +00:00
|
|
|
let mut state = use_signal(|| 0);
|
|
|
|
|
2024-02-01 00:33:53 +00:00
|
|
|
use_future(move || async move {
|
2024-01-19 00:27:43 +00:00
|
|
|
loop {
|
|
|
|
state += 1;
|
|
|
|
tokio::time::sleep(std::time::Duration::from_millis(1)).await;
|
2023-10-17 19:45:37 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-01-14 05:12:21 +00:00
|
|
|
rsx! {
|
2024-01-31 02:42:36 +00:00
|
|
|
button { onclick: move |_| state.set(0), "reset" }
|
2023-10-17 19:45:37 +00:00
|
|
|
for _ in 0..10000 {
|
2024-01-31 02:42:36 +00:00
|
|
|
div { "hello desktop! {state}" }
|
2023-10-17 19:45:37 +00:00
|
|
|
}
|
2024-01-14 05:12:21 +00:00
|
|
|
}
|
2023-10-17 19:45:37 +00:00
|
|
|
}
|