async-sleep-aki

Crates.ioasync-sleep-aki
lib.rsasync-sleep-aki
version0.1.2
created_at2026-01-10 16:05:36.173189+00
updated_at2026-01-12 11:50:00.19251+00
descriptionIt provides simple `async_sleep()` that work well in both web browsers and native applications.
homepage
repositoryhttps://github.com/aki-akaguma/async-sleep-aki
max_upload_size
id2034382
size71,897
(aki-akaguma)

documentation

README

async-sleep-aki

crate Docs Rust Version Apache2/MIT licensed Test ubu Test mac Test win

It provides simple async_sleep() that work well in both web browsers and native applications. This can be used in the dioxus application.

Howto use

Just call async_sleep() on the frontend or backend.

async_sleep(100).await;

In dioxus component:

use dioxus::prelude::*;
use async_sleep_aki::delayed_call;

#[component]
fn func() -> Element {
    let mut is_loading = use_signal(|| false);
    use_effect(move ||{
        spawn(delayed_call(2000, async move {
            if *is_loading.read() {
                is_loading.set(false);
            }
        }));
    });
    rsx!{ div{} }
}

Implementation

If target is wasm32-unknown-unknown, calls gloo_timers::future::sleep(), otherwise calls tokio::time::sleep().

Changelogs

This crate's changelog here.

License

This project is licensed under either of

at your option.

Commit count: 6

cargo fmt