@pathmaker-digital/pmd-utilities - v2.2.6
    Preparing search index...

    Function debounce

    • Creates a debounced function that delays the invocation of the provided function until after the specified wait time has passed since the last time it was invoked.

      Parameters

      • fn: Function

        The function to debounce.

      • wait: number

        The number of milliseconds to wait before calling the function.

      Returns (...args: any[]) => void

      A debounced function.

      const debouncedLog = debounce((message: string) => console.log(message), 500);
      debouncedLog("Hello"); // Will log "Hello" after 500ms if no other calls happen in that time.