gloo-timers
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).
```rust 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.