maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
31 lines (30 loc) • 790 B
TypeScript
export interface TimerOptions {
/**
* The time in milliseconds
* @default 1000
*/
timeout?: number;
/**
* The callback to execute when the timer is finished
* @default undefined
*/
callback?: () => unknown;
/**
* The interval to update the remaining time
* @default 200
*/
remainingTimeUpdate?: number;
/**
* The offset time to execute the callback
* @default 0
*/
callbackOffsetTime?: number;
}
export declare function useTimer({ timeout, callback, remainingTimeUpdate, callbackOffsetTime }: TimerOptions): {
remainingTime: import('vue').Ref<number, number>;
start: (timeout?: number) => void;
pause: () => void;
resume: () => void;
stop: () => void;
reset: () => void;
};