Documentation
¶
Overview ¶
Package cable implements utility functions for scheduling/limiting function calls
Index ¶
- func Debounce(fn func(), interval time.Duration) (debouncedFunc func())
- func DebounceImmediate(fn func(), interval time.Duration) (debouncedFunc func())
- func ExecuteEvery(interval time.Duration, fn func() bool) (cancel func())
- func ExecuteEveryImmediate(interval time.Duration, fn func() bool) (cancel func())
- func Throttle(fn func(), interval time.Duration) (throttledFunc func())
- func ThrottleImmediate(fn func(), interval time.Duration) (throttledFunc func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debounce ¶
Debounce returns a function that no matter how many times it is invoked, it will only execute after the specified interval has passed from its last invocation
func DebounceImmediate ¶
DebounceImmediate behaves as the Debounce function but it will also invoke the fn function immediately
func ExecuteEvery ¶
ExecuteEvery executes function fn repeatedly with a fixed time delay(interval) between each call until function fn returns false. It returns a cancel function which can be used to cancel as well the execution of function
func ExecuteEveryImmediate ¶
ExecuteEveryImmediate behaves as the ExecuteEvery function but it will also invoke the fn function immediately
func Throttle ¶
Throttle returns a function that no matter how many times it is invoked, it will only execute once within the specified interval
func ThrottleImmediate ¶
ThrottleImmediate behaves as the Throttle function but it will also invoke the fn function immediately
Types ¶
This section is empty.