Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useTimeoutFn.md
1---2category: Animation3---45# useTimeoutFn67Wrapper for `setTimeout` with controls.89## Usage1011```ts12import { useTimeoutFn } from '@vueuse/core'1314const { isPending, start, stop } = useTimeoutFn(() => {15/* ... */16}, 3000)17```1819## Type Declarations2021```ts22export interface UseTimeoutFnOptions {23/**24* Start the timer immediately25*26* @default true27*/28immediate?: boolean29/**30* Execute the callback immediately after calling `start`31*32* @default false33*/34immediateCallback?: boolean35}36export type UseTimeoutFnReturn<CallbackFn extends AnyFn> = Stoppable<37Parameters<CallbackFn> | []38>39/**40* Wrapper for `setTimeout` with controls.41*42* @param cb43* @param interval44* @param options45*/46export declare function useTimeoutFn<CallbackFn extends AnyFn>(47cb: CallbackFn,48interval: MaybeRefOrGetter<number>,49options?: UseTimeoutFnOptions,50): UseTimeoutFnReturn<CallbackFn>51```52