Crates.io | gloo-timers |
lib.rs | gloo-timers |
version | 0.3.0 |
source | src |
created_at | 2019-09-13 11:49:44.838113 |
updated_at | 2023-08-11 16:04:38.773701 |
description | Convenience crate for working with JavaScript timers |
homepage | https://github.com/rustwasm/gloo |
repository | https://github.com/rustwasm/gloo/tree/master/crates/timers |
max_upload_size | |
id | 164548 |
size | 22,125 |
gloo-timers
Built with 🦀🕸 by The Rust and WebAssembly Working Group
Working with timers on the Web: setTimeout
and setInterval
.
These APIs come in two flavors:
Future
s and Stream
s API.Timeouts fire once after a period of time (measured in milliseconds).
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();
Future
sWith the futures
feature enabled, a future
module containing futures-based
timers is exposed.