Use of async_std::task::sleep instead of tokio::time::sleep in examples (#2912)

* Use of async_std::task::sleep instead of tokio::time::sleep

* Make the clock example run on wasm

* Add control_focus and eval examples to Cargo.toml

* Use web-time on desktop; It just falls back to std on non-wasm platforms

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
ASR-ASUandEvan Almloff authored and GitHub committed 2024-09-03 15:16:37 +00:00
1 parent ffb5c98449
commit 1dfa1b5e7f
9 files changed
+47 -26

No files matched your search

+3 -2
View File
@@ -7,10 +7,11 @@
//!
//! This example is more of a demonstration of the behavior than a practical use case, but it's still interesting to see.
use async_std::task::sleep;
use dioxus::prelude::*;
fn main() {
launch_desktop(app);
launch(app);
}
fn app() -> Element {
@@ -48,7 +49,7 @@ fn Child(count: Signal<i32>) -> Element {
use_future(move || async move {
loop {
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
sleep(std::time::Duration::from_millis(100)).await;
println!("Child")
}
});