Home / Function/ watch() — vue Function Reference

watch() — vue Function Reference

Architecture documentation for the watch() function in apiWatch.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  de6a892d_79ff_ad64_7fc3_5f2fc0b51eb0["watch()"]
  880ea200_f528_af26_3f6f_c77fc2f21647["doWatch()"]
  880ea200_f528_af26_3f6f_c77fc2f21647 -->|calls| de6a892d_79ff_ad64_7fc3_5f2fc0b51eb0
  27ac0da7_848d_2b52_5b63_5eb582827a0b["watchEffect()"]
  de6a892d_79ff_ad64_7fc3_5f2fc0b51eb0 -->|calls| 27ac0da7_848d_2b52_5b63_5eb582827a0b
  880ea200_f528_af26_3f6f_c77fc2f21647["doWatch()"]
  de6a892d_79ff_ad64_7fc3_5f2fc0b51eb0 -->|calls| 880ea200_f528_af26_3f6f_c77fc2f21647
  style de6a892d_79ff_ad64_7fc3_5f2fc0b51eb0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/v3/apiWatch.ts lines 139–152

export function watch<T = any, Immediate extends Readonly<boolean> = false>(
  source: T | WatchSource<T>,
  cb: any,
  options?: WatchOptions<Immediate>
): WatchStopHandle {
  if (__DEV__ && typeof cb !== 'function') {
    warn(
      `\`watch(fn, options?)\` signature has been moved to a separate API. ` +
        `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
        `supports \`watch(source, cb, options?) signature.`
    )
  }
  return doWatch(source as any, cb, options)
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does watch() do?
watch() is a function in the vue codebase.
What does watch() call?
watch() calls 2 function(s): doWatch, watchEffect.
What calls watch()?
watch() is called by 1 function(s): doWatch.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free