Registry / utility / gloo-timers

gloo-timers

JSON →
library0.4.0rscratesunverified

Provides convenient wrappers for working with JavaScript timers (setTimeout, setInterval) in WebAssembly.

# Cargo.toml [dependencies] gloo-timers = "0.4.0"
INSTALL
IMPORT
SIG · GLOO-TIMERS
G
gloo-timers
utilityrustv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Timeout
use gloo_timers::callback::Timeout;

Creates a one-second timeout that logs a message.

use gloo_timers::callback::Timeout; let timeout = Timeout::new(1000, move || { // This runs after 1 second. web_sys::console::log_1(&"Hello".into()); }); timeout.forget(); // Prevent cancellation.
Debug
Known issues
gotchaOnly works in a WebAssembly environment with JavaScript bindings.
fix
Ensure target is wasm32-unknown-unknown and wasm-bindgen is set up.
affects: >=0.4.0
Upgrade
Version history
0.4.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
gloo-timers — cargo add gloo-timers · libregistry