Function debounce

  • EN: Debounce

    ZH: 去抖

    Usage:

    const foo = debounce(() => {
    console.log('The debounced function will only be invoked in 1000 milliseconds, the other invoking will disappear during the wait time.');
    }, 1000, true);

    Type Parameters

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

    Parameters

    • func: T
    • wait: number
    • Optional immediate: boolean

    Returns DebounceFunc<T>