Skip to content

⬅️ Back to Table of Contents

📄 useInterval

📊 Analysis Summary

Metric Count
🔧 Functions 3
📦 Imports 6
📐 Interfaces 2
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/shared/useInterval/index.ts

📦 Imports

Name Source
MaybeRefOrGetter vue
ShallowRef vue
Pausable ../utils
shallowReadonly vue
shallowRef vue
useIntervalFn ../useIntervalFn

Functions

useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<false>): Readonly<ShallowRef<number>>

Reactive counter increases on every interval

Parameters:

  • interval any: No description
  • options any: No description

See: https://vueuse.org/useInterval

Raw JSDoc
/**
 * Reactive counter increases on every interval
 *
 * @see https://vueuse.org/useInterval
 * @param interval
 * @param options
 */
Code
export function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>

Internal helpers

Declared inside another function in this file.

update(): any

Returns: any

Code
() => counter.value += 1

reset(): void

Returns: void

Code
() => {
    counter.value = 0
  }

Interfaces

UseIntervalOptions<Controls extends boolean>

Interface Code
export interface UseIntervalOptions<Controls extends boolean> {
  /**
   * Expose more controls
   *
   * @default false
   */
  controls?: Controls

  /**
   * Execute the update immediately on calling
   *
   * @default true
   */
  immediate?: boolean

  /**
   * Callback on every interval
   */
  callback?: (count: number) => void
}

Properties

Name Type Optional Description
controls Controls not shown
immediate boolean not shown
callback (count: number) => void not shown

UseIntervalControls

Interface Code
export interface UseIntervalControls {
  counter: ShallowRef<number>
  reset: () => void
}

Properties

Name Type Optional Description
counter ShallowRef<number> not shown
reset () => void not shown

Type Aliases

UseIntervalReturn

type UseIntervalReturn = Readonly<ShallowRef<number>> | Readonly<UseIntervalControls & Pausable>;

Generated by Syntax Scribe