This is a delay-based debouncer, where given a minimum delay and an action to issue, we'll build a stateful component that will eventually issue the action once, after being given a slew of requests within the delay timeframe.
{ elapsed : Maybe (Elapsed a) }
The state of the debouncer
init : Model a
The initial debouncer
To bounce the debouncer, just make multiple calls to Bounce
.
update : Time.Posix -> Msg a -> Model a -> ( Model a, Platform.Cmd.Cmd (Result (Msg a) a) )
The main logic of the debouncer.