debounce

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debounce

type Debounce struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Debounce lets you run a function unless it is already running, queueing a run after any existing run.

func New

func New(op func()) *Debounce

New returns a Debounce.

func (*Debounce) Run

func (d *Debounce) Run()

Run starts running our op, but not if the function is still running. Instead, a single run will start after the existing one completes (regardless of how many Run()s were called during the existing run).

func (*Debounce) Wait

func (d *Debounce) Wait()

Wait waits until all operations complete. Also waits until at least 1 operation has run for this Debounce.

Jump to

Keyboard shortcuts

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