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

Function createDevRenderContext

packages/runtime-core/src/componentPublicInstance.ts:647–670  ·  view source on GitHub ↗
(instance: ComponentInternalInstance)

Source from the content-addressed store, hash-verified

645// for easier console inspection. In prod mode it will be an empty object so
646// these properties definitions can be skipped.
647export function createDevRenderContext(instance: ComponentInternalInstance) {
648 const target: Record<string, any> = {}
649
650 // expose internal instance for proxy handlers
651 Object.defineProperty(target, `_`, {
652 configurable: true,
653 enumerable: false,
654 get: () => instance,
655 })
656
657 // expose public properties
658 Object.keys(publicPropertiesMap).forEach(key => {
659 Object.defineProperty(target, key, {
660 configurable: true,
661 enumerable: false,
662 get: () => publicPropertiesMap[key](instance),
663 // intercepted by the proxy so no need for implementation,
664 // but needed to prevent set errors
665 set: NOOP,
666 })
667 })
668
669 return target as ComponentRenderContext
670}
671
672// dev only
673export function exposePropsOnRenderContext(

Callers 1

createComponentInstanceFunction · 0.90

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected