bep/debounce

A debouncer written in Go.

Go

140

33 commits

updated Aug 21, 2026

See the code

README

Go Debounce

Tests on Linux, MacOS and Windows GoDoc codecov Release

Example

func ExampleNew() {
	var counter uint64

	f := func() {
		atomic.AddUint64(&counter, 1)
	}

	debounced := debounce.New(100 * time.Millisecond)

	for i := 0; i < 3; i++ {
		for j := 0; j < 10; j++ {
			debounced(f)
		}

		time.Sleep(200 * time.Millisecond)
	}

	c := int(atomic.LoadUint64(&counter))

	fmt.Println("Counter is", c)
	// Output: Counter is 3
}

bep/debounce

A debouncer written in Go.

Go

140

33 commits

updated Aug 21, 2026

See the code

README

Go Debounce

Tests on Linux, MacOS and Windows GoDoc codecov Release

Example

func ExampleNew() {
	var counter uint64

	f := func() {
		atomic.AddUint64(&counter, 1)
	}

	debounced := debounce.New(100 * time.Millisecond)

	for i := 0; i < 3; i++ {
		for j := 0; j < 10; j++ {
			debounced(f)
		}

		time.Sleep(200 * time.Millisecond)
	}

	c := int(atomic.LoadUint64(&counter))

	fmt.Println("Counter is", c)
	// Output: Counter is 3
}

Significant stargazers

Ben Boyter

748 followers · starred May 2023

Alexandre Vilain

101 followers · starred Dec 2024