Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Unstable API which exposes internals for testing.
Synopsis
- data DebounceSettings = DebounceSettings {
- debounceFreq :: Int
- debounceAction :: IO ()
- debounceEdge :: DebounceEdge
- data DebounceEdge
- leadingEdge :: DebounceEdge
- trailingEdge :: DebounceEdge
- mkDebounceInternal :: MVar () -> (Int -> IO ()) -> DebounceSettings -> IO (IO ())
Documentation
data DebounceSettings Source #
Settings to control how debouncing should work.
This should be constructed using defaultDebounceSettings
and record
update syntax, e.g.:
let settings =defaultDebounceSettings
{debounceAction
= flushLog }
Since: 0.1.2
DebounceSettings | |
|
data DebounceEdge Source #
Setting to control whether the action happens at the leading and/or trailing edge of the timeout.
Since: 0.1.6
Leading | Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, wait until the end of the cooldown and then perform the action again, then enter a new cooldown period. |
Trailing | Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it has no effect. |
Instances
Eq DebounceEdge Source # | |
Defined in Control.Debounce.Internal (==) :: DebounceEdge -> DebounceEdge -> Bool # (/=) :: DebounceEdge -> DebounceEdge -> Bool # | |
Show DebounceEdge Source # | |
Defined in Control.Debounce.Internal showsPrec :: Int -> DebounceEdge -> ShowS # show :: DebounceEdge -> String # showList :: [DebounceEdge] -> ShowS # |
leadingEdge :: DebounceEdge Source #
Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, wait until the end of the cooldown and then perform the action again, then enter a new cooldown period.
Since: 0.1.6
trailingEdge :: DebounceEdge Source #
Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it has no effect.
Since: 0.1.6
mkDebounceInternal :: MVar () -> (Int -> IO ()) -> DebounceSettings -> IO (IO ()) Source #