Home / File/ apiWatch.ts — vue Source File

apiWatch.ts — vue Source File

Architecture documentation for apiWatch.ts, a typescript file in the vue codebase. 17 imports, 0 dependents.

File typescript VueCore GlobalAPI 17 imports 9 functions

Entity Profile

Dependency Diagram

graph LR
  e5380f01_49bc_d965_1141_151fb5c6c097["apiWatch.ts"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b["ref.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  f264de96_ce30_ab7e_6f2f_bd7a1a19804f["isRef"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> f264de96_ce30_ab7e_6f2f_bd7a1a19804f
  29d11db1_dfc1_094c_66f0_0ae7d09000cd["Ref"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 29d11db1_dfc1_094c_66f0_0ae7d09000cd
  49a97e06_4034_4e1d_a0e8_bb7368ceb3af["computed.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 49a97e06_4034_4e1d_a0e8_bb7368ceb3af
  c1022451_fe7d_86ca_fc56_5925030205c7["ComputedRef"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> c1022451_fe7d_86ca_fc56_5925030205c7
  e84ea476_9f30_e7b9_aaa0_4026f0c97365["reactive.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> e84ea476_9f30_e7b9_aaa0_4026f0c97365
  cfa7ea60_e211_687f_9deb_b342e671fcc2["isReactive"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> cfa7ea60_e211_687f_9deb_b342e671fcc2
  9c37c7df_b33a_f5b7_931d_e335ff41ce94["isShallow"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 9c37c7df_b33a_f5b7_931d_e335ff41ce94
  9f3b1774_ebd5_0845_1a85_868e0c1fd480["currentInstance.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 9f3b1774_ebd5_0845_1a85_868e0c1fd480
  093a7a23_fa4b_6464_b268_8f9d10bcaa2f["watcher.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f
  6447431e_6924_8ca8_071d_44b55ba081b1["Watcher"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 6447431e_6924_8ca8_071d_44b55ba081b1
  36c7708b_24b4_08c9_e39f_50f332a4b206["scheduler.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 36c7708b_24b4_08c9_e39f_50f332a4b206
  b4e0d823_0133_d156_5392_8b2e8367ebd9["queueWatcher"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> b4e0d823_0133_d156_5392_8b2e8367ebd9
  85e1f909_7644_0ca7_f1dd_88c92922f129["debug.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 85e1f909_7644_0ca7_f1dd_88c92922f129
  style e5380f01_49bc_d965_1141_151fb5c6c097 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isRef, Ref } from './reactivity/ref'
import { ComputedRef } from './reactivity/computed'
import { isReactive, isShallow } from './reactivity/reactive'
import {
  warn,
  noop,
  isArray,
  isFunction,
  emptyObject,
  hasChanged,
  isServerRendering,
  invokeWithErrorHandling
} from 'core/util'
import { currentInstance } from './currentInstance'
import { traverse } from 'core/observer/traverse'
import Watcher from '../core/observer/watcher'
import { queueWatcher } from '../core/observer/scheduler'
import { DebuggerOptions } from './debug'

const WATCHER = `watcher`
const WATCHER_CB = `${WATCHER} callback`
const WATCHER_GETTER = `${WATCHER} getter`
const WATCHER_CLEANUP = `${WATCHER} cleanup`

export type WatchEffect = (onCleanup: OnCleanup) => void

export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T)

export type WatchCallback<V = any, OV = any> = (
  value: V,
  oldValue: OV,
  onCleanup: OnCleanup
) => any

type MapSources<T, Immediate> = {
  [K in keyof T]: T[K] extends WatchSource<infer V>
    ? Immediate extends true
      ? V | undefined
      : V
    : T[K] extends object
    ? Immediate extends true
      ? T[K] | undefined
      : T[K]
    : never
}

type OnCleanup = (cleanupFn: () => void) => void

export interface WatchOptionsBase extends DebuggerOptions {
  flush?: 'pre' | 'post' | 'sync'
}

export interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
  immediate?: Immediate
  deep?: boolean
}

export type WatchStopHandle = () => void

// Simple effect.
// ... (294 more lines)

Domain

Subdomains

Frequently Asked Questions

What does apiWatch.ts do?
apiWatch.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, GlobalAPI subdomain.
What functions are defined in apiWatch.ts?
apiWatch.ts defines 9 function(s): T, cleanupFn, doWatch, onCleanup, value, watch, watchEffect, watchPostEffect, watchSyncEffect.
What does apiWatch.ts depend on?
apiWatch.ts imports 17 module(s): ComputedRef, DebuggerOptions, Ref, Watcher, computed.ts, currentInstance.ts, debug.ts, isReactive, and 9 more.
Where is apiWatch.ts in the architecture?
apiWatch.ts is located at src/v3/apiWatch.ts (domain: VueCore, subdomain: GlobalAPI, directory: src/v3).

Analyze Your Own Codebase

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

Try Supermodel Free