Please wait for 3 seconds

useTimeoutFn

Wrapper for setTimeout with controls.

import { useTimeoutFn } from '@vueuse/core'

const { isPending, start, stop } = useTimeoutFn(() => {
  /* ... */
}, 3000)

Type Declarations

export interface TimeoutFnResult {
  start: Fn
  stop: Fn
  isPending: Ref<boolean>
  /**
   * @deprecated use `isPending` instead
   */
  isActive: Ref<boolean>
}
/**
 * Wrapper for `setTimeout` with controls.
 *
 * @param cb
 * @param interval
 * @param immediate
 */
export declare function useTimeoutFn(
  cb: (...args: unknown[]) => any,
  interval?: number,
  immediate?: boolean
): TimeoutFnResult

Source

SourceDemoDocs