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
}
-
-
Notifications
You must be signed in to change notification settings - Fork 15
A debouncer written in Go.
License
bep/debounce
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A debouncer written in Go.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published