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