import { MaybeRefOrGetter, ShallowRef } from "vue"; //#region src/composables/useTimer/index.d.ts interface TimerOptions { /** * Duration in milliseconds. Accepts a plain number, ref, or getter — the * value is read fresh each time `start()` is invoked, so reactive sources * can change between runs without recreating the timer. * * @default 1000 * * @example * ```ts * useTimer(handler, { duration: 5000 }) * useTimer(handler, { duration: () => isFast.value ? 100 : 1000 }) * ``` */ duration?: MaybeRefOrGetter; /** * Whether the timer repeats after firing. * @default false */ repeat?: boolean; } interface TimerContext { /** Start the timer. Restarts if already running. */ start: () => void; /** Stop the timer and reset remaining to full duration. */ stop: () => void; /** Pause the timer, preserving remaining time. No-op if not running. */ pause: () => void; /** Resume from where pause left off. No-op if not paused. */ resume: () => void; /** Milliseconds left until next fire. */ remaining: ShallowRef; /** Whether the timer is currently active (started and not stopped). */ isActive: ShallowRef; /** Whether the timer is currently paused. */ isPaused: ShallowRef; } /** * Creates a reactive timer with pause/resume support. * * @param handler Callback invoked when the timer fires. * @param options Timer configuration. * @returns Timer controls and reactive state. * * @see https://0.vuetifyjs.com/composables/system/use-timer * * @example * ```ts * const timer = useTimer(() => console.log('fired'), { duration: 5000 }) * * timer.start() * timer.pause() * timer.resume() * timer.stop() * * // Reactive duration — re-read on each start() * const duration = shallowRef(1000) * const reactive = useTimer(handler, { duration }) * duration.value = 2000 * reactive.start() // fires after 2000ms * ``` */ declare function useTimer(handler: () => void, options?: TimerOptions): TimerContext; //#endregion export { TimerContext, TimerOptions, useTimer };