Creates a debounced version of the provided function that delays its execution until after a specified delay has elapsed since the last time it was invoked.
The type of the function to debounce.
The function to debounce.
The number of milliseconds to delay.
A debounced function that delays invoking func until after delay milliseconds have elapsed since the last invocation.
func
delay
// ES Moduleimport { debounceFn } from '@bnidev/js-utils'// CommonJSconst { debounceFn } = require('@bnidev/js-utils') Copy
// ES Moduleimport { debounceFn } from '@bnidev/js-utils'// CommonJSconst { debounceFn } = require('@bnidev/js-utils')
const saveInput = (input: string) => { console.log(`Saving input: ${input}`)}debounceFn(saveInput, 300) Copy
const saveInput = (input: string) => { console.log(`Saving input: ${input}`)}debounceFn(saveInput, 300)
Creates a debounced version of the provided function that delays its execution until after a specified delay has elapsed since the last time it was invoked.