MCPcopy
hub / github.com/vuejs/composition-api / resolveInject

Function resolveInject

src/apis/inject.ts:14–27  ·  view source on GitHub ↗
(
  provideKey: InjectionKey<any> | string,
  vm: ComponentInstance
)

Source from the content-addressed store, hash-verified

12export interface InjectionKey<T> extends Symbol {}
13
14function resolveInject(
15 provideKey: InjectionKey<any> | string,
16 vm: ComponentInstance
17): any {
18 let source = vm
19 while (source) {
20 if (source._provided && hasOwn(source._provided, provideKey as PropertyKey)) {
21 return source._provided[provideKey as PropertyKey]
22 }
23 source = source.$parent
24 }
25
26 return NOT_FOUND
27}
28
29export function provide<T>(key: InjectionKey<T> | string, value: T): void {
30 const vm = getCurrentInstanceForFn('provide')?.proxy

Callers 1

injectFunction · 0.85

Calls 1

hasOwnFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…