Home / Function/ run() — vue Function Reference

run() — vue Function Reference

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

Function typescript CoreRuntime Observer calls 1 called by 4

Entity Profile

Dependency Diagram

graph TD
  a4fba0c0_c91e_f56f_3c69_5a18514bb8e1["run()"]
  e7f4f452_deed_8a48_b501_c415a06a6251["Watcher"]
  a4fba0c0_c91e_f56f_3c69_5a18514bb8e1 -->|defined in| e7f4f452_deed_8a48_b501_c415a06a6251
  635aa950_844d_5a47_5cc5_4e33768708f9["mountComponent()"]
  635aa950_844d_5a47_5cc5_4e33768708f9 -->|calls| a4fba0c0_c91e_f56f_3c69_5a18514bb8e1
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec["flushSchedulerQueue()"]
  f5b111c0_f7e1_77b3_8a0f_5e97da3014ec -->|calls| a4fba0c0_c91e_f56f_3c69_5a18514bb8e1
  4f1747ac_5aeb_b4ff_a868_1c9fed4bec76["update()"]
  4f1747ac_5aeb_b4ff_a868_1c9fed4bec76 -->|calls| a4fba0c0_c91e_f56f_3c69_5a18514bb8e1
  1b10e00d_02e6_305e_b4ad_0e11475c3139["doWatch()"]
  1b10e00d_02e6_305e_b4ad_0e11475c3139 -->|calls| a4fba0c0_c91e_f56f_3c69_5a18514bb8e1
  ad67e7ed_c155_de53_2de2_0458d2c842ef["get()"]
  a4fba0c0_c91e_f56f_3c69_5a18514bb8e1 -->|calls| ad67e7ed_c155_de53_2de2_0458d2c842ef
  style a4fba0c0_c91e_f56f_3c69_5a18514bb8e1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/observer/watcher.ts lines 211–239

  run() {
    if (this.active) {
      const value = this.get()
      if (
        value !== this.value ||
        // Deep watchers and watchers on Object/Arrays should fire even
        // when the value is the same, because the value may
        // have mutated.
        isObject(value) ||
        this.deep
      ) {
        // set new value
        const oldValue = this.value
        this.value = value
        if (this.user) {
          const info = `callback for watcher "${this.expression}"`
          invokeWithErrorHandling(
            this.cb,
            this.vm,
            [value, oldValue],
            this.vm,
            info
          )
        } else {
          this.cb.call(this.vm, value, oldValue)
        }
      }
    }
  }

Domain

Subdomains

Calls

Frequently Asked Questions

What does run() do?
run() is a function in the vue codebase, defined in src/core/observer/watcher.ts.
Where is run() defined?
run() is defined in src/core/observer/watcher.ts at line 211.
What does run() call?
run() calls 1 function(s): get.
What calls run()?
run() is called by 4 function(s): doWatch, flushSchedulerQueue, mountComponent, update.

Analyze Your Own Codebase

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

Try Supermodel Free