Home / File/ effectScope.ts — vue Source File

effectScope.ts — vue Source File

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

File typescript VueCore VDom 2 imports 4 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  2201dcb0_bcf7_bce0_da13_64df866d683f["effectScope.ts"]
  b0726a9b_3416_ba5e_8288_ca534387d48d["watcher"]
  2201dcb0_bcf7_bce0_da13_64df866d683f --> b0726a9b_3416_ba5e_8288_ca534387d48d
  6d8f8976_7066_720b_0d45_45fe42921eaf["util"]
  2201dcb0_bcf7_bce0_da13_64df866d683f --> 6d8f8976_7066_720b_0d45_45fe42921eaf
  style 2201dcb0_bcf7_bce0_da13_64df866d683f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Watcher from 'core/observer/watcher'
import { warn } from 'core/util'

export let activeEffectScope: EffectScope | undefined

export class EffectScope {
  /**
   * @internal
   */
  active = true
  /**
   * @internal
   */
  effects: Watcher[] = []
  /**
   * @internal
   */
  cleanups: (() => void)[] = []
  /**
   * @internal
   */
  parent: EffectScope | undefined
  /**
   * record undetached scopes
   * @internal
   */
  scopes: EffectScope[] | undefined
  /**
   * indicates this being a component root scope
   * @internal
   */
  _vm?: boolean
  /**
   * track a child scope's index in its parent's scopes array for optimized
   * removal
   */
  private index: number | undefined

  constructor(public detached = false) {
    this.parent = activeEffectScope
    if (!detached && activeEffectScope) {
      this.index =
        (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
          this
        ) - 1
    }
  }

  run<T>(fn: () => T): T | undefined {
    if (this.active) {
      const currentEffectScope = activeEffectScope
      try {
        activeEffectScope = this
        return fn()
      } finally {
        activeEffectScope = currentEffectScope
      }
    } else if (__DEV__) {
      warn(`cannot run an inactive effect scope.`)
    }
// ... (78 more lines)

Domain

Subdomains

Classes

Dependencies

  • util
  • watcher

Frequently Asked Questions

What does effectScope.ts do?
effectScope.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in effectScope.ts?
effectScope.ts defines 4 function(s): effectScope, getCurrentScope, onScopeDispose, recordEffectScope.
What does effectScope.ts depend on?
effectScope.ts imports 2 module(s): util, watcher.
Where is effectScope.ts in the architecture?
effectScope.ts is located at src/v3/reactivity/effectScope.ts (domain: VueCore, subdomain: VDom, directory: src/v3/reactivity).

Analyze Your Own Codebase

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

Try Supermodel Free