Skip to content

⬅️ Back to Table of Contents

📄 whenever

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 6
🟢 Vue Composition API 1
📐 Interfaces 1
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/shared/whenever/index.ts

📦 Imports

Name Source
WatchCallback vue
WatchHandle vue
WatchOptions vue
WatchSource vue
nextTick vue
watch vue

Vue Composition API

Name Type Reactive Variables Composables
watch watch none none

Functions

whenever(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T | undefined>, options: WheneverOptions<true>): WatchHandle

Shorthand for watching value to be truthy

See: https://vueuse.org/whenever

Raw JSDoc
/**
 * Shorthand for watching value to be truthy
 *
 * @see https://vueuse.org/whenever
 */
Code
export function whenever<T>(source: WatchSource<T>, cb: WatchCallback<Truthy<T>, T | undefined>, options?: WheneverOptions<true>): WatchHandle

Interfaces

WheneverOptions<Immediate = boolean>

Interface Code
export interface WheneverOptions<Immediate = boolean> extends WatchOptions<Immediate> {
  /**
   * Only trigger once when the condition is met
   *
   * Override the `once` option in `WatchOptions`
   *
   * @default false
   */
  once?: boolean
}

Properties

Name Type Optional Description
once boolean not shown

Type Aliases

Truthy<T>

type Truthy<T> = T extends false | null | undefined ? never : T;

Generated by Syntax Scribe