callHook() — vue Function Reference
Architecture documentation for the callHook() function in lifecycle.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb["callHook()"] ad112c37_faea_8798_03f1_18e1a6303f0d["initMixin()"] ad112c37_faea_8798_03f1_18e1a6303f0d -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb 1edb3174_323d_290c_a67e_82eeac5c460f["lifecycleMixin()"] 1edb3174_323d_290c_a67e_82eeac5c460f -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb 58398ca0_ee87_00ce_db95_d8e11ce46b1e["mountComponent()"] 58398ca0_ee87_00ce_db95_d8e11ce46b1e -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb d5689118_f863_cb10_9794_80b2a5de55a7["activateChildComponent()"] d5689118_f863_cb10_9794_80b2a5de55a7 -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb 1e40b5e4_897b_253f_e139_244ce2b36a54["deactivateChildComponent()"] 1e40b5e4_897b_253f_e139_244ce2b36a54 -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb cc03eaa1_014d_1aa1_3d2e_3e3ec49b0a7a["callUpdatedHooks()"] cc03eaa1_014d_1aa1_3d2e_3e3ec49b0a7a -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb ccaa32c4_bdac_209e_5d8f_fe43093907de["componentVNodeHooks.insert()"] ccaa32c4_bdac_209e_5d8f_fe43093907de -->|calls| a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb 0f6ffc11_2e95_459d_b27e_bbd8d5d18e4a["pushTarget()"] a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb -->|calls| 0f6ffc11_2e95_459d_b27e_bbd8d5d18e4a 1aca36d9_47bc_994e_cfa0_cf3a10c3386d["getCurrentScope()"] a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb -->|calls| 1aca36d9_47bc_994e_cfa0_cf3a10c3386d 387f4cc0_d1d8_687f_b954_207658b1a562["setCurrentInstance()"] a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb -->|calls| 387f4cc0_d1d8_687f_b954_207658b1a562 9b161907_798b_bb16_b516_2fe8d53e9145["on()"] a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb -->|calls| 9b161907_798b_bb16_b516_2fe8d53e9145 a51c7238_0b82_ad88_085b_cd519eb78568["popTarget()"] a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb -->|calls| a51c7238_0b82_ad88_085b_cd519eb78568 style a7fb5d54_f5e0_5d73_5f6a_96e6c47acbeb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/lifecycle.ts lines 394–421
export function callHook(
vm: Component,
hook: string,
args?: any[],
setContext = true
) {
// #7573 disable dep collection when invoking lifecycle hooks
pushTarget()
const prevInst = currentInstance
const prevScope = getCurrentScope()
setContext && setCurrentInstance(vm)
const handlers = vm.$options[hook]
const info = `${hook} hook`
if (handlers) {
for (let i = 0, j = handlers.length; i < j; i++) {
invokeWithErrorHandling(handlers[i], vm, args || null, vm, info)
}
}
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook)
}
if (setContext) {
setCurrentInstance(prevInst)
prevScope && prevScope.on()
}
popTarget()
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does callHook() do?
callHook() is a function in the vue codebase.
What does callHook() call?
callHook() calls 5 function(s): getCurrentScope, on, popTarget, pushTarget, setCurrentInstance.
What calls callHook()?
callHook() is called by 7 function(s): activateChildComponent, callUpdatedHooks, componentVNodeHooks.insert, deactivateChildComponent, initMixin, lifecycleMixin, mountComponent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free