UNPKG

@grail-ui/svelte

Version:

[![NPM](https://img.shields.io/npm/v/@grail-ui/svelte)](https://www.npmjs.com/package/@grail-ui/svelte) [![minified](https://img.shields.io/bundlephobia/min/@grail-ui/svelte)](https://bundlephobia.com/package/@grail-ui/svelte) [![minified + zipped](https:

35 lines (34 loc) 834 B
import type { Readable, Writable } from 'svelte/store'; export type TimeoutConfig = { /** * Whether to start the timer immediately. * * @defaultValue `true` */ immediate?: boolean; /** * Whether to cancel timer when hosting component is destroyed. * * @defaultValue `true` */ autoStop?: boolean; }; export type TimeoutReturn = { /** * Indicate whether is timer is running. */ isPending: Readable<boolean>; /** * Stop the timer. */ stop: VoidFunction; /** * Start the timer. */ start: VoidFunction; /** * The controlled delay of the timer. */ delay: Writable<number>; }; export declare function CreateTimeoutFn(callback: (...args: unknown[]) => unknown, ms: number, options?: TimeoutConfig): TimeoutReturn;