UNPKG

es-promise-ext

Version:

Native promise extensions for javascript and typescript.

15 lines (14 loc) 380 B
export type DelayFunction<T> = (value: T) => Promise<T>; /** * Delay between the promise chain. * * @return {Function<T>} * A value which pass through within a promise * * @example * Promise.resolve(3) * .then(delay(300)) * .then(doSomething) * // return 3 in a promise after delay 300 ms */ export default function delay<T>(millisecond: number): DelayFunction<T>;