2023-10-17 19:45:37 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
2024-01-14 05:12:21 +00:00
|
|
|
let state = use_signal(|| 0);
|
|
|
|
use_future(|_| {
|
2023-10-17 19:45:37 +00:00
|
|
|
to_owned![state];
|
|
|
|
async move {
|
|
|
|
loop {
|
|
|
|
state += 1;
|
|
|
|
tokio::time::sleep(std::time::Duration::from_millis(1)).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-01-14 05:12:21 +00:00
|
|
|
rsx! {
|
2023-10-17 19:45:37 +00:00
|
|
|
button {
|
|
|
|
onclick: move |_| {
|
|
|
|
state.set(0);
|
|
|
|
},
|
|
|
|
"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() {
|
|
|
|
dioxus_desktop::launch(app);
|
|
|
|
}
|