debouncer

package
v1.4.120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debouncer

type Debouncer[T any] interface {
	Flushable

	Do(T) Flushable
	Close()
}

Debouncer represents an entity capable of debouncing function calls.

func New added in v1.4.96

func New[T any](fn func(T), opts ...Option) Debouncer[T]

New is the Debouncer constructor.

type Flushable added in v1.4.102

type Flushable interface {
	Flush()
}

Flushable represents an entity capable of being flushed.

type Option added in v1.4.101

type Option func(*config)

func WithDebounceTime added in v1.4.101

func WithDebounceTime(d time.Duration) Option

WithDebounceTime sets the debounce time i.e. how long to wait without further invocations before firing. Defaults to 1 second.

func WithMaxWaitTime added in v1.4.101

func WithMaxWaitTime(d time.Duration) Option

WithMaxWaitTime sets the max wait time i.e. maximum time spent deferring invocations due to new invocations. Defaults to no maximum i.e. never fire for infinite successive invocations within the debounce time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL