Skip to content

Commit d3bd9f4

Browse files
docs(apiInject): re-add modified documentation in provide()
1 parent 64baaf6 commit d3bd9f4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/runtime-core/src/apiInject.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export function provide<T, K = InjectionKey<T> | string | number>(
1616
warn(`provide() can only be used inside setup().`)
1717
}
1818
} else {
19+
// by default an instance it creates its own provides object
20+
// using parent provides object as prototype.
21+
// this way in `inject` we can simply look up injections from direct
22+
// parent and let the prototype chain do the work.
1923
const provides = currentInstance.provides
2024
// TS doesn't allow symbol as index type
2125
provides[key as string] = value

0 commit comments

Comments
 (0)