diff options
Diffstat (limited to 'src/utils/debounce.ts')
-rw-r--r-- | src/utils/debounce.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/debounce.ts b/src/utils/debounce.ts index d9e19de..6e5bba6 100644 --- a/src/utils/debounce.ts +++ b/src/utils/debounce.ts @@ -16,6 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +/** + * Returns a new function that will call the wrapped function + * after the specified delay. If the function is called again + * within the delay, the timer will be reset. + * @param func The function to wrap + * @param delay The delay in milliseconds + */ export function debounce<T extends Function>(func: T, delay = 300): T { let timeout: NodeJS.Timeout; return function (...args: any[]) { |