2023-10-17 19:45:37 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
use_future(|| async move {
|
|
|
|
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! {
|
2023-10-17 19:45:37 +00:00
|
|
|
button {
|
2024-01-19 22:19:49 +00:00
|
|
|
onclick: move |_| state.set(0),
|
2023-10-17 19:45:37 +00:00
|
|
|
"reset"
|
|
|
|
}
|
|
|
|
for _ in 0..10000 {
|
|
|
|
div {
|
|
|
|
"hello desktop! {state}"
|
|
|
|
}
|
|
|
|
}
|
2024-01-14 05:12:21 +00:00
|
|
|
}
|
2023-10-17 19:45:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-01-20 00:36:40 +00:00
|
|
|
dioxus::desktop::launch::launch(app, Default::default(), Default::default());
|
2023-10-17 19:45:37 +00:00
|
|
|
}
|