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:
1 parent
ffb5c98449
commit
1dfa1b5e7f
9 files changed
+47
-26
No files matched your search
@@ -3,13 +3,15 @@
|
||||
//! This example shows how to manage focus in a Dioxus application. We implement a "roulette" that focuses on each input
|
||||
//! in the grid every few milliseconds until the user interacts with the inputs.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
use std::rc::Rc;
|
||||
|
||||
use async_std::task::sleep;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
const STYLE: &str = asset!("./examples/assets/roulette.css");
|
||||
|
||||
fn main() {
|
||||
launch_desktop(app);
|
||||
launch(app);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
@@ -21,7 +23,7 @@ fn app() -> Element {
|
||||
let mut focused = 0;
|
||||
|
||||
loop {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
|
||||
sleep(std::time::Duration::from_millis(50)).await;
|
||||
|
||||
if !running() {
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user