debounce

package
v0.0.0-...-61e80cf Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebounceableRefresher

type DebounceableRefresher struct {
	sync.Mutex
	// Refreshable is any type that can be refreshed. The refresh method should by protected by a mutex internally.
	Refreshable Refreshable
	// contains filtered or unexported fields
}

DebounceableRefresher is used to debounce multiple attempts to refresh a refreshable type.

func (*DebounceableRefresher) RefreshAfter

func (d *DebounceableRefresher) RefreshAfter(duration time.Duration)

RefreshAfter requests a refresh after a certain time has passed. Subsequent calls to this method will delay the requested refresh by the new duration. Note that this is a total override of the previous calls - calling RefreshAfter(time.Second * 2) and then immediately calling RefreshAfter(time.Microsecond * 1) will run a refresh in one microsecond

type Refreshable

type Refreshable interface {
	Refresh() error
}

Refreshable represents an object which can be refreshed. This should be protected by a mutex for concurrent operation.

Jump to

Keyboard shortcuts

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