Interval fired: 0

useInterval

Reactive counter increases on every interval

Usage




 

import { useInterval } from '@vueuse/core'

// count will increase every 200ms
const counter = useInterval(200)
const { counter, pause, resume } = useInterval(200, { controls: true })

Type Declarations

export interface IntervalOptions<Controls extends boolean> {
  /**
   * Expose more controls
   *
   * @default false
   */
  controls?: Controls
  /**
   * Exccute the update immediately on calling
   *
   * @default true
   */
  immediate?: boolean
}
export declare function useInterval(
  interval?: number,
  options?: IntervalOptions<false>
): Ref<number>
export declare function useInterval(
  interval: number,
  options: IntervalOptions<true>
): {
  counter: Ref<number>
} & Pausable

Source

SourceDemoDocs