MCPcopy
hub / github.com/vuejs/core / provide

Function provide

packages/runtime-core/src/apiCreateApp.ts:449–468  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

447 },
448
449 provide(key, value) {
450 if (__DEV__ && (key as string | symbol) in context.provides) {
451 if (hasOwn(context.provides, key as string | symbol)) {
452 warn(
453 `App already provides property with key "${String(key)}". ` +
454 `It will be overwritten with the new value.`,
455 )
456 } else {
457 // #13212, context.provides can inherit the provides object from parent on custom elements
458 warn(
459 `App already provides property with key "${String(key)}" inherited from its parent element. ` +
460 `It will be overwritten with the new value.`,
461 )
462 }
463 }
464
465 context.provides[key as string | symbol] = value
466
467 return app
468 },
469
470 runWithContext(fn) {
471 const lastApp = currentApp

Callers

nothing calls this directly

Calls 3

hasOwnFunction · 0.90
warnFunction · 0.90
StringInterface · 0.85

Tested by

no test coverage detected