/** * @returns a no operation function */ export declare const noop: () => undefined; /** * @returns a function that returns a resolved Promise */ export declare const asyncNoop: () => Promise; /** * Make a function executable only once, following calls are ignored * @returns fn, wrapped to run only upon first execution */ export declare function once any>(fn: T): T; /** * Ensures `func` will be called with at least `wait` ms between runs. * @example * ```ts * // if `func` is called 3 times in a row: * func(1); func(2); func(3); * // it will wait `wait` ms between each run: * func(1); * await sleep(wait); * func(2); * await sleep(wait); * func(3);` * ``` * This is not throttling (!) since eventually all calls will be ran, * while in throttling the calls in the "wait" period are skipped. */ export declare function delayed any>(fn: T, wait: number): (...args: Parameters) => Promise>; /** * Ensures that when the async function `fn` is called twice in a row, the * second call only begins after the first one has finished (successfully or not). * * @example * ``` * const doWork = enforceSequentialExecution(() => { * console.log('start'); * await sleep(1000); * console.log('end'); * }); * void doWork(); * void doWork(); * // Result: start, end, start, end * ``` */ export declare function enforceSequentialExecution Promise>>(fn: T): T; /** * * @param fn a function to memoize * @param argsHash a function that returns a string hash for the arguments, defaults to JSON.stringify * @returns a memoized version of `fn` */ export declare function memoize any>(fn: T, argsHash?: (args: Parameters) => string): T & { __cache: Map>; }; //# sourceMappingURL=functions.d.ts.map