jney / buu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buu

buu

Debouncer

The debouncer is partly based on https://github.com/bep/debounce. context.Context was added in order to ensure passed function would be called even if the program is stopped

debouncer := NewDebouncer(context.Background(), 80*time.Millisecond)
debouncer.Add(myFunc)
debouncer.Add(myFunc)

the debouncer will run the last function on <-ctx.Done

Throttler

throttler := NewThrottler(context.Background(), 80*time.Millisecond)
throttler.Add(myFunc)
throttler.Add(myFunc)

the throttler will not run the queued functions on <-ctx.Done

About


Languages

Language:Go 98.9%Language:Makefile 1.1%