dioxus-time

Crates.iodioxus-time
lib.rsdioxus-time
version
sourcesrc
created_at2025-04-13 05:14:21.850208+00
updated_at2025-04-18 23:42:01.716629+00
descriptionTiming utilities and hooks for Dioxus.
homepagehttps://dioxuslabs.com
repositoryhttps://github.com/DioxusLabs/sdk/
max_upload_size
id1631525
Cargo.toml error:TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Miles Murgaw (DogeDark)

documentation

README

Dioxus Time

Timing utilities and hooks for Dioxus.

Features:

  • Intervals
  • Debounces
  • Timeouts

Usage

Add dioxus-time to your Cargo.toml:

[dependencies]
dioxus-time = "0.1"

Example:

use dioxus::{logger::tracing::info, prelude::*};
use dioxus_time::{use_debounce, use_interval};
use std::time::Duration;

fn main() {
    launch(App);
}

#[component]
fn App() -> Element {
    let mut count = use_signal(|| 0);

    // Increment count every second.
    use_interval(Duration::from_secs(1), move || count += 1);

    // Reset count after 2 seconds of the latest action call.
    let mut debounce = use_debounce(Duration::from_millis(2000), move |text| {
        info!("{text}");
        count.set(0);
    });

    rsx! {
        p { "{count}" },
        button {
            // Trigger the debounce.
            onclick: move |_| debounce.action("button was clicked"),
            "Reset the counter! (2 second debounce)"
        }
    }
}

Dioxus Compatibility

This table represents the compatibility between this crate and Dioxus versions. The crate version supports a Dioxus version up until the next crate version in the table.

E.g. if crate version 0.1 supported Dioxus 0.6 and crate version 0.4 supported Dioxus 0.7, crate versions 0.1, 0.2, and 0.3 would support Dioxus 0.6.

Crate Version Dioxus Version
0.1 0.6
Commit count: 81

cargo fmt