Home / Function/ effect() — vue Function Reference

effect() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4293e343_c5d0_d20e_4ab0_3cecd55215bd["effect()"]
  069f27e9_5ae2_91da_c6c6_a92cd4436f7e["effect.ts"]
  4293e343_c5d0_d20e_4ab0_3cecd55215bd -->|defined in| 069f27e9_5ae2_91da_c6c6_a92cd4436f7e
  style 4293e343_c5d0_d20e_4ab0_3cecd55215bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/v3/reactivity/effect.ts lines 11–20

export function effect(fn: () => any, scheduler?: (cb: any) => void) {
  const watcher = new Watcher(currentInstance, fn, noop, {
    sync: true
  })
  if (scheduler) {
    watcher.update = () => {
      scheduler(() => watcher.run())
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does effect() do?
effect() is a function in the vue codebase, defined in src/v3/reactivity/effect.ts.
Where is effect() defined?
effect() is defined in src/v3/reactivity/effect.ts at line 11.

Analyze Your Own Codebase

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

Try Supermodel Free