• Creates a debounced function that delays execution until after a specified wait time.

    ✅ Works in Node.js, React, and React Native.

    Type Parameters

    • T extends ((...args) => unknown)

    Parameters

    • fn: T

      The function to debounce

    • delay: number

      The number of milliseconds to delay

    Returns ((...args) => void)

    A debounced version of the function

      • (...args): void
      • Parameters

        • Rest ...args: Parameters<T>

        Returns void

    Example

    const debouncedSearch = debounce(searchFunction, 300);
    debouncedSearch('query') // Will only execute after 300ms of no calls

    // In React/React Native:
    const handleInputChange = debounce((value) => {
    // API call or expensive operation
    }, 500);

Generated using TypeDoc