/** * A utility class to manage dynamically adjusted timeouts based on how often * each unique ID is triggered. Also provides polling support for asynchronous conditions. */ declare class TinyTimeout { #private; /** * Creates a new instance of TinyTimeout. * * @param {Object} [options={}] Optional configuration object. * @param {number} [options.cooldownWatcherTime=5000] Interval in milliseconds for reducing `now` counters. * @param {boolean} [options.allowAutoConfigChange=false] Whether to allow auto value changes for existing IDs. */ constructor({ cooldownWatcherTime, allowAutoConfigChange }?: { cooldownWatcherTime?: number; allowAutoConfigChange?: boolean; }); /** * Whether this instance has been destroyed and is no longer usable. * * @returns {boolean} */ isDestroyed(): boolean; /** * Whether auto config change is enabled. * * @returns {boolean} */ getAllowAutoConfigChange(): boolean; /** * Gets the interval time used for cooldown decrementing. * * @returns {number} */ getCooldownWatcherTime(): number; /** * Sets whether to allow auto-updating an ID's timeout config if `value` changes. * * @param {boolean} value */ setAllowAutoConfigChange(value: boolean): void; /** * Sets the cooldown watcher interval time. * Automatically resets the interval if it was already running. * * @param {number} value */ setCooldownWatcherTime(value: number): void; /** * Schedules a callback using a dynamically adjusted timeout based on usage frequency. * The more often an ID is triggered, the longer the timeout becomes, * scaled by the provided `value`. Optionally, the delay can be limited by `limit`. * * @param {string} id - A unique identifier to track timeout usage. * @param {Function} callback - The function to execute after the delay. * @param {number} value - Base delay multiplier in milliseconds. * @param {number|null} [limit=null] - Optional maximum delay cap. * @returns {number} Handle to the scheduled timeout. * @throws {Error} Throws if the instance has been destroyed or arguments are invalid. */ set(id: string, callback: Function, value: number, limit?: number | null): number; /** * Instance version of `waitForTrue`, which defaults to using the instance's * cooldownWatcherTime if not explicitly provided. * * @param {() => boolean} getValue - A function that returns `true` when the condition is met. * @param {number|null} [checkInterval=100] - How often (in ms) to check the condition. * @returns {Promise} Resolves when the condition is met. * @throws {Error} If the instance is destroyed or arguments are invalid. */ waitForTrue(getValue: () => boolean, checkInterval?: number | null): Promise; /** * Cleans up all internal references and stops the cooldown watcher. * After calling this, the instance becomes unusable. */ destroy(): void; } export default TinyTimeout; //# sourceMappingURL=TinyTimeout.d.mts.map