hd-utils
Version:
A handy utils for modern JS developers
6 lines (5 loc) • 312 B
TypeScript
/**
* @description Delays a function for the given number of milliseconds, and then calls it with the arguments supplied.
* @example delay(()=>{console.log(1)} , 1000) // will be called after 1s.
*/
export default function delay<T = any>(cb: (...args: any[]) => T, time?: number, ...args: any[]): Promise<T>;