Home / Function/ updateListeners() — vue Function Reference

updateListeners() — vue Function Reference

Architecture documentation for the updateListeners() function in update-listeners.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  267404f1_c1f9_093c_5774_34422e2a9325["updateListeners()"]
  7f419c38_1808_67d5_1ca3_e9e34cfea81d["normalizeEvent()"]
  267404f1_c1f9_093c_5774_34422e2a9325 -->|calls| 7f419c38_1808_67d5_1ca3_e9e34cfea81d
  a1f5b8ca_b6d5_6b24_155e_038685c97c85["isUndef()"]
  267404f1_c1f9_093c_5774_34422e2a9325 -->|calls| a1f5b8ca_b6d5_6b24_155e_038685c97c85
  fe6b8b90_7070_0e25_6bde_83bb08e4398c["createFnInvoker()"]
  267404f1_c1f9_093c_5774_34422e2a9325 -->|calls| fe6b8b90_7070_0e25_6bde_83bb08e4398c
  7b3aa424_9089_4803_a4c7_86c4f80ba973["isTrue()"]
  267404f1_c1f9_093c_5774_34422e2a9325 -->|calls| 7b3aa424_9089_4803_a4c7_86c4f80ba973
  5670215c_12e8_f1ac_96f5_43fa02f28d30["remove()"]
  267404f1_c1f9_093c_5774_34422e2a9325 -->|calls| 5670215c_12e8_f1ac_96f5_43fa02f28d30
  style 267404f1_c1f9_093c_5774_34422e2a9325 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/vdom/helpers/update-listeners.ts lines 63–101

export function updateListeners(
  on: Object,
  oldOn: Object,
  add: Function,
  remove: Function,
  createOnceHandler: Function,
  vm: Component
) {
  let name, cur, old, event
  for (name in on) {
    cur = on[name]
    old = oldOn[name]
    event = normalizeEvent(name)
    if (isUndef(cur)) {
      __DEV__ &&
        warn(
          `Invalid handler for event "${event.name}": got ` + String(cur),
          vm
        )
    } else if (isUndef(old)) {
      if (isUndef(cur.fns)) {
        cur = on[name] = createFnInvoker(cur, vm)
      }
      if (isTrue(event.once)) {
        cur = on[name] = createOnceHandler(event.name, cur, event.capture)
      }
      add(event.name, cur, event.capture, event.passive, event.params)
    } else if (cur !== old) {
      old.fns = cur
      on[name] = old
    }
  }
  for (name in oldOn) {
    if (isUndef(on[name])) {
      event = normalizeEvent(name)
      remove(event.name, oldOn[name], event.capture)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does updateListeners() do?
updateListeners() is a function in the vue codebase.
What does updateListeners() call?
updateListeners() calls 5 function(s): createFnInvoker, isTrue, isUndef, normalizeEvent, remove.

Analyze Your Own Codebase

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

Try Supermodel Free