Import std.time.timers
Debounce
class
Public Class Debounce
Acts once a burst of events has stopped: each Signal starts the delay again, and Ready says True once the delay has gone by since the latest, and then not again until another Signal.
Examples
Local start = Instant.FromNanoseconds(0)
Local save = Debounce(300.Milliseconds)
save.Signal(start)
save.Signal(start + 100.Milliseconds)
Expect(!save.Ready(start + 300.Milliseconds))
Expect(save.Ready(start + 400.Milliseconds) && !save.IsPending)-
A Debounce of that
delay, which panics for one below 0. -
An event, now or at the Instant.
-
An event at
now. -
Whether a Signal waits for its delay.
-
Whether to act, now or at the Instant: True once the delay has gone by since the latest Signal, which it then forgets.
-
Whether to act at
now: True once the delay has gone by since the latest Signal, which it then forgets. -
Forgets the latest Signal.
Report an issue with this page or with FutureBlitz on GitHub.