mirror of
https://github.com/samber/lo.git
synced 2026-04-22 15:37:14 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
906 B
906 B
name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
| name | slug | sourceRef | category | subCategory | playUrl | variantHelpers | similarHelpers | position | signatures | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NewDebounce | newdebounce | retry.go#L54 | core | concurrency | https://go.dev/play/p/_IPY7ROzbMk |
|
|
0 |
|
Creates a debounced function that delays invoking the callbacks until after the wait duration has elapsed since the last call. Returns the debounced function and a cancel function.
debounce, cancel := lo.NewDebounce(
100 * time.Millisecond,
func() {
println("Called once after debounce!")
},
)
for i := 0; i < 10; i++ {
debounce()
}
time.Sleep(200 * time.Millisecond)
cancel()