Please wait for 3 seconds

useTimeoutFn

Wrapper for setTimeout with controls.

import { useTimeoutFn } from '@vueuse/core'

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

Type Declarations

/**
 * Wrapper for `setTimeout` with controls.
 *
 * @param cb
 * @param interval
 * @param immediate
 */
export declare function useTimeoutFn(
  cb: () => any,
  interval?: number,
  immediate?: boolean
): {
  isActive: Ref<boolean>
  start: () => void
  stop: () => void
}

Source

SourceDemoDocs