/** * A reusable timer class that executes a callback function after a specified delay. * It handles potential drifts or early triggers by checking the actual remaining time * before executing the action. */ export declare class Timer { /** The delay duration in milliseconds before the timer expires. */ readonly delay: number; /** The callback function to perform when the timer expires. */ private action; /** The internal timeout identifier reference, if a timer is active. */ private timer?; /** The timestamp (in milliseconds) indicating when the timer is scheduled to end. */ private end; /** Indicates whether the timer is currently active and running. */ private running; /** * Initializes a new instance of the Timer. * @param {Function} action - The callback function to execute upon expiration. * @param {number} delay - The delay duration in milliseconds. * @param {boolean} [wait=false] - If true, the timer will not start automatically until reset() is called. */ constructor(action: Function, delay: number, wait?: boolean); /** * Starts the internal setTimeout with the specified delay. * @param {number} delay - The duration in milliseconds for the timeout. */ private startTimer; /** * Internal handler triggered when the timeout fires. * Verifies if the target end time has genuinely passed, rescheduling if necessary, * or executes the action. */ private ring; /** * Resets the timer, recalculating the end time and restarting the countdown. * If the timer is already running, it updates the target end time. */ reset(): void; /** * Cancels the active timeout and stops the timer from running. */ clear(): void; } //# sourceMappingURL=timer.d.ts.map