/
View dependency graph
Depends on
- dh-cargo (dh-cargo)
- rust-futures-core (librust-futures-core-0.3+default-dev)
- cargo, debhelper-compat, librust-futures-channel-0.3+default-dev, librust-js-sys-0.3+default-dev, librust-wasm-bindgen-0.2+default-dev, libstd-rust-dev, rustc
README (full)
gloo-timers
API Docs | Contributing | Chat
Built with 🦀🕸 by The Rust and WebAssembly Working Group
Working with timers on the Web: setTimeout and setInterval.
These APIs come in two flavors:
- a callback style (that more directly mimics the JavaScript APIs), and
- a
Futures andStreams API.
Timeouts
Timeouts fire once after a period of time (measured in milliseconds).
Timeouts with a Callback Function
use gloo_timers::callback::Timeout;
let timeout = Timeout::new(1_000, move || {
// Do something after the one second timeout is up!
});
// Since we don't plan on cancelling the timeout, call `forget`.
timeout.forget();
Timeouts as Futures
With the futures feature enabled, a future module containing futures-based
timers is exposed.
| dir | debian/ |
| dir | src/ |
| dir | tests/ |
| file | .cargo_vcs_info.json |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | README.md |