Home / File/ watcher.ts — vue Source File

watcher.ts — vue Source File

Architecture documentation for watcher.ts, a typescript file in the vue codebase. 9 imports, 4 dependents.

File typescript VueCore Observer 9 imports 4 dependents 1 classes

Entity Profile

Dependency Diagram

graph LR
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f["watcher.ts"]
  76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 76672dd6_4e87_4468_a48b_f4da793fd211
  19a79cc7_5fb4_4746_0453_f0f304dd29a7["traverse.ts"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 19a79cc7_5fb4_4746_0453_f0f304dd29a7
  1590b3d4_b603_9a95_ff78_1330c383e860["traverse"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 1590b3d4_b603_9a95_ff78_1330c383e860
  36c7708b_24b4_08c9_e39f_50f332a4b206["scheduler.ts"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 36c7708b_24b4_08c9_e39f_50f332a4b206
  b4e0d823_0133_d156_5392_8b2e8367ebd9["queueWatcher"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> b4e0d823_0133_d156_5392_8b2e8367ebd9
  e5c4d6ab_2495_a6d4_d962_9d9f71bf3114["dep.ts"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> e5c4d6ab_2495_a6d4_d962_9d9f71bf3114
  24bdbf1b_c076_fe3e_ac9f_bb7aa065c8d7["debug"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 24bdbf1b_c076_fe3e_ac9f_bb7aa065c8d7
  64c87498_c46a_6944_ab9d_8e45519852a8["component"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 64c87498_c46a_6944_ab9d_8e45519852a8
  f5422b53_9179_f817_eaa1_8a0b044ba11a["effectScope"]
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> f5422b53_9179_f817_eaa1_8a0b044ba11a
  d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"]
  d937f76e_061f_a631_9587_336503c9a15c --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f
  079339bc_f0ce_0fd0_3d1b_26a2dc073616["state.ts"]
  079339bc_f0ce_0fd0_3d1b_26a2dc073616 --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f
  36c7708b_24b4_08c9_e39f_50f332a4b206["scheduler.ts"]
  36c7708b_24b4_08c9_e39f_50f332a4b206 --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f
  e5380f01_49bc_d965_1141_151fb5c6c097["apiWatch.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f
  style 093a7a23_fa4b_6464_b268_8f9d10bcaa2f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
  warn,
  remove,
  isObject,
  parsePath,
  _Set as Set,
  handleError,
  invokeWithErrorHandling,
  noop,
  isFunction
} from '../util/index'

import { traverse } from './traverse'
import { queueWatcher } from './scheduler'
import Dep, { pushTarget, popTarget, DepTarget } from './dep'
import { DebuggerEvent, DebuggerOptions } from 'v3/debug'

import type { SimpleSet } from '../util/index'
import type { Component } from 'types/component'
import { activeEffectScope, recordEffectScope } from 'v3/reactivity/effectScope'

let uid = 0

/**
 * @internal
 */
export interface WatcherOptions extends DebuggerOptions {
  deep?: boolean
  user?: boolean
  lazy?: boolean
  sync?: boolean
  before?: Function
}

/**
 * A watcher parses an expression, collects dependencies,
 * and fires callback when the expression value changes.
 * This is used for both the $watch() api and directives.
 * @internal
 */
export default class Watcher implements DepTarget {
  vm?: Component | null
  expression: string
  cb: Function
  id: number
  deep: boolean
  user: boolean
  lazy: boolean
  sync: boolean
  dirty: boolean
  active: boolean
  deps: Array<Dep>
  newDeps: Array<Dep>
  depIds: SimpleSet
  newDepIds: SimpleSet
  before?: Function
  onStop?: Function
  noRecurse?: boolean
  getter: Function
  value: any
// ... (219 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does watcher.ts do?
watcher.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Observer subdomain.
What does watcher.ts depend on?
watcher.ts imports 9 module(s): component, debug, dep.ts, effectScope, index.ts, queueWatcher, scheduler.ts, traverse, and 1 more.
What files import watcher.ts?
watcher.ts is imported by 4 file(s): apiWatch.ts, lifecycle.ts, scheduler.ts, state.ts.
Where is watcher.ts in the architecture?
watcher.ts is located at src/core/observer/watcher.ts (domain: VueCore, subdomain: Observer, directory: src/core/observer).

Analyze Your Own Codebase

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

Try Supermodel Free