UNPKG

hd-utils

Version:

A handy utils for modern JS developers

10 lines (9 loc) 451 B
/** * * @description it will throttlePromise the call of the function param to wait for n seconds. * @example const func = (hello: string) => { console.log(new Date().getTime(), '>>>', hello) } * const thrFunc = throttlePromise(func, 1000) * thrFunc('hello 1') */ declare const throttlePromise: <F extends (...args: any[]) => any>(func: F, waitFor?: number) => (...args: Parameters<F>) => Promise<ReturnType<F>>; export default throttlePromise;