@bnidev/js-utils
    Preparing search index...

    Function debounceFn

    • 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.

      Type Parameters

      • T extends (...args: unknown[]) => void

        The type of the function to debounce.

      Parameters

      • func: T

        The function to debounce.

      • delay: number

        The number of milliseconds to delay.

      Returns (...args: Parameters<T>) => void

      A debounced function that delays invoking func until after delay milliseconds have elapsed since the last invocation.

      // ES Module
      import { debounceFn } from '@bnidev/js-utils'

      // CommonJS
      const { debounceFn } = require('@bnidev/js-utils')
      const saveInput = (input: string) => {
      console.log(`Saving input: ${input}`)
      }

      debounceFn(saveInput, 300)