debounce-microtasks
Version:
Debounce a function using microtasks instead of timers.
18 lines • 816 B
TypeScript
import { type Function, type Options } from "./DebounceMicrotask.js";
/**
* @module
*
* A simple utility to debounce a function to the next microtask, returning
* promises that resolves with the next execution.
*/
/**
* Execute the function in the next microtask, if the function is called again
* later in the event loop, push back the execution one more microtask
* in the future.
*
* The debounced function will return a promise that resolves with the return
* value when the specified function is executed, while the non-promise version
* has no way to capture the return values.
*/
export declare const debounceMicrotask: <TArgs extends unknown[], TReturn>(fn: Function<TArgs, TReturn>, options?: Options) => Function<TArgs, Promise<TReturn>>;
//# sourceMappingURL=DebounceMicrotaskPromise.d.ts.map