svelte-ux
Version:
- Increment version in `package.json` and commit as `Version bump to x.y.z` - `npm run publish`
18 lines (17 loc) • 612 B
TypeScript
export type TimerOptions = {
delay?: number;
disabled?: boolean;
/** Called on each interval tick. Returned value is used to update store value, defaulting to current Date */
onTick?: () => any;
};
/**
* Subscribable timer store
*/
export default function timerStore<T = any>(options?: TimerOptions): {
subscribe: (this: void, run: import("svelte/store").Subscriber<T>, invalidate?: (value?: T) => void) => import("svelte/store").Unsubscriber;
start: () => void;
stop: () => void;
isRunning: () => boolean;
getDelay: () => number;
setDelay: (value: number) => void;
};