2020-04-30 05:37:44 +02:00
|
|
|
//! Listen and react to time.
|
2022-01-28 17:05:09 +07:00
|
|
|
pub use crate::runtime::time::{Duration, Instant};
|
|
|
|
|
|
2020-04-30 05:37:44 +02:00
|
|
|
use crate::Subscription;
|
|
|
|
|
|
|
|
|
|
/// Returns a [`Subscription`] that produces messages at a set interval.
|
|
|
|
|
///
|
|
|
|
|
/// The first message is produced after a `duration`, and then continues to
|
|
|
|
|
/// produce more messages every `duration` after that.
|
2022-01-28 17:05:09 +07:00
|
|
|
pub fn every(duration: Duration) -> Subscription<Instant> {
|
2020-04-30 05:37:44 +02:00
|
|
|
iced_futures::time::every(duration)
|
|
|
|
|
}
|