oxd/types/utils/promiseDebounce.d.ts
2023-05-02 09:36:43 +08:00

11 lines
416 B
TypeScript

/**
* Regular debounce function returns undefined and cannot be
* used in promise chain. this debounce function will return
* a promise and resolve it after set interval
*
* source:
* https://stackoverflow.com/questions/35228052/debounce-function-implemented-with-promises
*
*/
export default function promiseDebounce(exec: (...args: any[]) => Promise<any>, interval: number): () => ReturnType<typeof exec>;