debounce

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debounce

func Debounce[T interface{}](fn func(args ...T), wait int, options Options) (func(args ...T), func(), func())

Creates a debounced function that delays invoking `fn` until after wait milliseconds have elapsed since the last time the debounced function was invoked. The debounced function comes with a cancel method to cancel delayed `fn` invocations and a flush method to immediately invoke them. Provide options to indicate whether `fn` should be invoked on the leading and/or trailing edge of the wait timeout. The `fn` is invoked with the last arguments provided to the debounced function. Subsequent calls to the debounced function return the result of the last func invocation.

Types

type Options

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL