_update() — vue Function Reference
Architecture documentation for the _update() function in directives.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD c17676a5_46ed_d3dd_d968_0fa11724f89d["_update()"] a07220f3_beb1_7821_9810_d794a7a56504["directives.ts"] c17676a5_46ed_d3dd_d968_0fa11724f89d -->|defined in| a07220f3_beb1_7821_9810_d794a7a56504 67cc9c40_0253_1452_7081_d52aeee8a6ce["updateDirectives()"] 67cc9c40_0253_1452_7081_d52aeee8a6ce -->|calls| c17676a5_46ed_d3dd_d968_0fa11724f89d d582937b_dc98_d390_a8bf_68c0aa0feedf["normalizeDirectives()"] c17676a5_46ed_d3dd_d968_0fa11724f89d -->|calls| d582937b_dc98_d390_a8bf_68c0aa0feedf 3b888604_82d9_e163_e6ba_cc72b61a7802["callHook()"] c17676a5_46ed_d3dd_d968_0fa11724f89d -->|calls| 3b888604_82d9_e163_e6ba_cc72b61a7802 style c17676a5_46ed_d3dd_d968_0fa11724f89d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/vdom/modules/directives.ts lines 22–84
function _update(oldVnode, vnode) {
const isCreate = oldVnode === emptyNode
const isDestroy = vnode === emptyNode
const oldDirs = normalizeDirectives(
oldVnode.data.directives,
oldVnode.context
)
const newDirs = normalizeDirectives(vnode.data.directives, vnode.context)
const dirsWithInsert: any[] = []
const dirsWithPostpatch: any[] = []
let key, oldDir, dir
for (key in newDirs) {
oldDir = oldDirs[key]
dir = newDirs[key]
if (!oldDir) {
// new directive, bind
callHook(dir, 'bind', vnode, oldVnode)
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir)
}
} else {
// existing directive, update
dir.oldValue = oldDir.value
dir.oldArg = oldDir.arg
callHook(dir, 'update', vnode, oldVnode)
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir)
}
}
}
if (dirsWithInsert.length) {
const callInsert = () => {
for (let i = 0; i < dirsWithInsert.length; i++) {
callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode)
}
}
if (isCreate) {
mergeVNodeHook(vnode, 'insert', callInsert)
} else {
callInsert()
}
}
if (dirsWithPostpatch.length) {
mergeVNodeHook(vnode, 'postpatch', () => {
for (let i = 0; i < dirsWithPostpatch.length; i++) {
callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode)
}
})
}
if (!isCreate) {
for (key in oldDirs) {
if (!newDirs[key]) {
// no longer present, unbind
callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy)
}
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _update() do?
_update() is a function in the vue codebase, defined in src/core/vdom/modules/directives.ts.
Where is _update() defined?
_update() is defined in src/core/vdom/modules/directives.ts at line 22.
What does _update() call?
_update() calls 2 function(s): callHook, normalizeDirectives.
What calls _update()?
_update() is called by 1 function(s): updateDirectives.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free