//#region src/common/exec/throttle-debounce.d.ts /** * A special throttle implementation that tries to distribute execution * in an optimal way. * * **Functionality:** For UI usage the function is executed on first occasion (`leading`). * If more calls follow it will again be executed at end (`trailing`). * If the next call is inside the timeframe, it is delayed until `trailing`. * This avoids timewise too close calls. * It is possible to `cancel` the timeout and to `flush` a call, e.g. if * leaving UI situation where a final call is required to write data or similar. */ declare function throttle any>(callback: F, opt?: { delay?: number; trailing?: boolean; leading?: boolean; }): F & { /** Stop all timers, do not exec nothing */cancel: () => void; /** Stop all timers and execute right now. */ immediate: (...args: Parameters) => Promise; /** Stop all timers and execute trailing call, if exists. */ stop: () => void; dispose: () => void; }; /** * Debounce fits best for filtering a large peak of events. * For UI event filtering throttle is probably a better choice. * * **Functionality:** It only fires after triggers pause for `delay` ms. */ declare function debounce any | Promise>(callback: F, opt?: { delay?: number; }): F & { cancel: () => void; immediate: (...args: Parameters) => Promise; dispose: () => void; }; //#endregion export { throttle as n, debounce as t }; //# sourceMappingURL=throttle-debounce-CCh0F100.d.mts.map