initExtend() — vue Function Reference
Architecture documentation for the initExtend() function in extend.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD ce425d9f_05ad_8df9_9c70_37c35a2bdb0e["initExtend()"] a14b0815_48fb_998a_d3d7_ac867ed1d7f9["extend.ts"] ce425d9f_05ad_8df9_9c70_37c35a2bdb0e -->|defined in| a14b0815_48fb_998a_d3d7_ac867ed1d7f9 ee699f75_f5be_8f7a_91c2_18232c62b421["initGlobalAPI()"] ee699f75_f5be_8f7a_91c2_18232c62b421 -->|calls| ce425d9f_05ad_8df9_9c70_37c35a2bdb0e 16abdeb5_17d6_b741_ca16_dfc41a7d0df5["getComponentName()"] ce425d9f_05ad_8df9_9c70_37c35a2bdb0e -->|calls| 16abdeb5_17d6_b741_ca16_dfc41a7d0df5 c750fd7d_92c7_85b0_ab1c_c459424e4fb5["initProps()"] ce425d9f_05ad_8df9_9c70_37c35a2bdb0e -->|calls| c750fd7d_92c7_85b0_ab1c_c459424e4fb5 bbde495f_48f3_a910_410f_28718d2c8ee1["initComputed()"] ce425d9f_05ad_8df9_9c70_37c35a2bdb0e -->|calls| bbde495f_48f3_a910_410f_28718d2c8ee1 style ce425d9f_05ad_8df9_9c70_37c35a2bdb0e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/global-api/extend.ts lines 8–80
export function initExtend(Vue: GlobalAPI) {
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
Vue.cid = 0
let cid = 1
/**
* Class inheritance
*/
Vue.extend = function (extendOptions: any): typeof Component {
extendOptions = extendOptions || {}
const Super = this
const SuperId = Super.cid
const cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {})
if (cachedCtors[SuperId]) {
return cachedCtors[SuperId]
}
const name =
getComponentName(extendOptions) || getComponentName(Super.options)
if (__DEV__ && name) {
validateComponentName(name)
}
const Sub = function VueComponent(this: any, options: any) {
this._init(options)
} as unknown as typeof Component
Sub.prototype = Object.create(Super.prototype)
Sub.prototype.constructor = Sub
Sub.cid = cid++
Sub.options = mergeOptions(Super.options, extendOptions)
Sub['super'] = Super
// For props and computed properties, we define the proxy getters on
// the Vue instances at extension time, on the extended prototype. This
// avoids Object.defineProperty calls for each instance created.
if (Sub.options.props) {
initProps(Sub)
}
if (Sub.options.computed) {
initComputed(Sub)
}
// allow further extension/mixin/plugin usage
Sub.extend = Super.extend
Sub.mixin = Super.mixin
Sub.use = Super.use
// create asset registers, so extended classes
// can have their private assets too.
ASSET_TYPES.forEach(function (type) {
Sub[type] = Super[type]
})
// enable recursive self-lookup
if (name) {
Sub.options.components[name] = Sub
}
// keep a reference to the super options at extension time.
// later at instantiation we can check if Super's options have
// been updated.
Sub.superOptions = Super.options
Sub.extendOptions = extendOptions
Sub.sealedOptions = extend({}, Sub.options)
// cache constructor
cachedCtors[SuperId] = Sub
return Sub
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does initExtend() do?
initExtend() is a function in the vue codebase, defined in src/core/global-api/extend.ts.
Where is initExtend() defined?
initExtend() is defined in src/core/global-api/extend.ts at line 8.
What does initExtend() call?
initExtend() calls 3 function(s): getComponentName, initComputed, initProps.
What calls initExtend()?
initExtend() is called by 1 function(s): initGlobalAPI.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free