Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debouncer ¶
type Debouncer struct {
// contains filtered or unexported fields
}
Debouncer ensures the callback function is not executed too frequently. Debouncer only call the callback function after a given time without new bounce event, or the time after the previous execution reaches the max duration.
func New ¶
func New(debounceAfter, debounceMax time.Duration, callback func(), stop <-chan struct{}) *Debouncer
NewDebouncer create a Debouncer. The callback function will be called after Bounce function stops being called for debounceAfter, or the total duration reaches debounceMax. A event sent to stop channel will stop the Debouncer. Callback will be called in the go routine of the Debouncer, so make sure any resources used in the Callback to be thread-safe.
Click to show internal directories.
Click to hide internal directories.