fn debounce
Emits an element only after d passed without a newer one (the last element of a burst); the pending element is
emitted when the stream ends.
Example:
use std.stream { debounce }
fn burst() -> stream<i32> {
for i in 1..=3 { yield i }
}
fn main() io, time {
var out: List<i32> = []
// a burst collapses into its last element
for await x in burst() |> debounce(50ms) {
out.push(x)
}
print("{out}")
}Output
[3]
pub(api) fn debounce<T, E>(s: stream<T, E>, d: Duration) -> stream<T, E> timeComplexity. O(1) per element.
Since. 1.0.0-beta
Parameters
Returns
stream<T, E>
Effects
time
Defined in: std/stream/stream.oxl:488