import { AsyncCancelableCallback, CancelableCallback, GenericAsyncCallback, GenericCallback } from "../models.mjs"; //#region src/function/limit.d.ts /** * Debounce a function, ensuring it is only called after `time` milliseconds have passed * * - When called, successful _(finished)_ results will resolve and errors will reject * - On subsequent calls, existing calls will be canceled _(rejected)_, the timer reset, and will wait another `time` milliseconds before the new call is made _(and so on...)_ * * _Available as `asyncDebounce` and `debounce.async`_ * * @param callback Callback to debounce * @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_ * @returns Debounced callback handler with a `cancel` method */ declare function asyncDebounce(callback: Callback, time?: number): AsyncCancelableCallback; /** * Throttle a function, ensuring it is only called once every `time` milliseconds * * - When called, successful _(finished)_ results will resolve and errors will reject * - On subsequent calls, existing calls will be canceled _(rejected)_ and will wait until the next valid time to call the callback again _(and so on...)_ * * _Available as `asyncThrottle` and `throttle.async`_ * * @param callback Callback to throttle * @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_ * @returns Throttled callback handler with a `cancel` method */ declare function asyncThrottle(callback: Callback, time?: number): AsyncCancelableCallback; /** * Debounce a function, ensuring it is only called after `time` milliseconds have passed * * On subsequent calls, the timer is reset and will wait another `time` milliseconds _(and so on...)_ * * @param callback Callback to debounce * @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_ * @returns Debounced callback handler with a `cancel` method */ declare function debounce(callback: Callback, time?: number): CancelableCallback; declare namespace debounce { var async: typeof asyncDebounce; } /** * Throttle a function, ensuring it is only called once every `time` milliseconds * * @param callback Callback to throttle * @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_ * @returns Throttled callback handler with a `cancel` method */ declare function throttle(callback: Callback, time?: number): CancelableCallback; declare namespace throttle { var async: typeof asyncThrottle; } //#endregion export { asyncDebounce, asyncThrottle, debounce, throttle };