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 CoreRuntime Observer 9 imports 4 dependents 1 classes

Entity Profile

Dependency Diagram

graph LR
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283["watcher.ts"]
  2a298df2_21b8_7e5a_c372_51ba50c9d92d["index.ts"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 2a298df2_21b8_7e5a_c372_51ba50c9d92d
  e9c21780_b26b_d883_76bb_2657a89bfce1["traverse.ts"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> e9c21780_b26b_d883_76bb_2657a89bfce1
  4b47a246_a6fe_7a21_1238_3f5ce49d861f["traverse"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 4b47a246_a6fe_7a21_1238_3f5ce49d861f
  7cc5a667_1876_f28e_e26f_27fcdcba292e["scheduler.ts"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 7cc5a667_1876_f28e_e26f_27fcdcba292e
  331094c1_856e_230e_e56a_5500d0a6236f["queueWatcher"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 331094c1_856e_230e_e56a_5500d0a6236f
  dfb2b3e1_ffba_6029_124e_b43a30f0f999["dep.ts"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> dfb2b3e1_ffba_6029_124e_b43a30f0f999
  f2c3de10_6aa3_651e_95a0_8deb68068b87["debug"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> f2c3de10_6aa3_651e_95a0_8deb68068b87
  907f4994_ea28_43b1_7976_0db9f0e97637["component"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 907f4994_ea28_43b1_7976_0db9f0e97637
  b9e2c8f8_e40f_d13c_47c1_35fc432c6051["effectScope"]
  acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> b9e2c8f8_e40f_d13c_47c1_35fc432c6051
  f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"]
  f3560440_54c1_5663_36f8_c7de54d7310b --> acd39cb4_1b40_1f96_d7d8_00ba7dc7b283
  910d3a96_5984_cf85_40a3_47933bd75818["state.ts"]
  910d3a96_5984_cf85_40a3_47933bd75818 --> acd39cb4_1b40_1f96_d7d8_00ba7dc7b283
  7cc5a667_1876_f28e_e26f_27fcdcba292e["scheduler.ts"]
  7cc5a667_1876_f28e_e26f_27fcdcba292e --> acd39cb4_1b40_1f96_d7d8_00ba7dc7b283
  38aa88fe_678d_7728_4258_240bdb85b32b["apiWatch.ts"]
  38aa88fe_678d_7728_4258_240bdb85b32b --> acd39cb4_1b40_1f96_d7d8_00ba7dc7b283
  style acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 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 CoreRuntime 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: CoreRuntime, 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