resolveInject() — vue Function Reference
Architecture documentation for the resolveInject() function in inject.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD ad8ba0ef_7fa6_8283_6f50_d72913808144["resolveInject()"] 174af5d8_4bd9_7899_1b31_f3a3cb9b77c6["initInjections()"] 174af5d8_4bd9_7899_1b31_f3a3cb9b77c6 -->|calls| ad8ba0ef_7fa6_8283_6f50_d72913808144 2a3d2c68_f002_d816_7b35_bdbc95f4434c["FunctionalRenderContext()"] 2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| ad8ba0ef_7fa6_8283_6f50_d72913808144 style ad8ba0ef_7fa6_8283_6f50_d72913808144 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/inject.ts lines 53–80
export function resolveInject(
inject: any,
vm: Component
): Record<string, any> | undefined | null {
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
const result = Object.create(null)
const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject)
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
// #6574 in case the inject object is observed...
if (key === '__ob__') continue
const provideKey = inject[key].from
if (provideKey in vm._provided) {
result[key] = vm._provided[provideKey]
} else if ('default' in inject[key]) {
const provideDefault = inject[key].default
result[key] = isFunction(provideDefault)
? provideDefault.call(vm)
: provideDefault
} else if (__DEV__) {
warn(`Injection "${key as string}" not found`, vm)
}
}
return result
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does resolveInject() do?
resolveInject() is a function in the vue codebase.
What calls resolveInject()?
resolveInject() is called by 2 function(s): FunctionalRenderContext, initInjections.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free