add stress test for desktop

This commit is contained in:
Evan Almloff committed 2023-10-17 14:45:37 -05:00
1 parent c807808231
commit a4fbeeb932
2 files changed
+61 -29

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
use dioxus::prelude::*;
fn app(cx: Scope) -> Element {
let state = use_state(cx, || 0);
use_future(cx, (), |_| {
to_owned![state];
async move {
loop {
state += 1;
tokio::time::sleep(std::time::Duration::from_millis(1)).await;
}
}
});
cx.render(rsx! {
button {
onclick: move |_| {
state.set(0);
},
"reset"
}
for _ in 0..10000 {
div {
"hello desktop! {state}"
}
}
})
}
fn main() {
dioxus_desktop::launch(app);
}