MCPcopy Index your code
hub / github.com/TruthHun/BookStack / initExtend

Function initExtend

static/vuejs/vue.js:3883–3963  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

3881/* */
3882
3883function initExtend (Vue) {
3884 /**
3885 * Each instance constructor, including Vue, has a unique
3886 * cid. This enables us to create wrapped "child
3887 * constructors" for prototypal inheritance and cache them.
3888 */
3889 Vue.cid = 0;
3890 var cid = 1;
3891
3892 /**
3893 * Class inheritance
3894 */
3895 Vue.extend = function (extendOptions) {
3896 extendOptions = extendOptions || {};
3897 var Super = this;
3898 var SuperId = Super.cid;
3899 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
3900 if (cachedCtors[SuperId]) {
3901 return cachedCtors[SuperId]
3902 }
3903
3904 var name = extendOptions.name || Super.options.name;
3905 {
3906 if (!/^[a-zA-Z][\w-]*$/.test(name)) {
3907 warn(
3908 'Invalid component name: "' + name + '". Component names ' +
3909 'can only contain alphanumeric characters and the hyphen, ' +
3910 'and must start with a letter.'
3911 );
3912 }
3913 }
3914
3915 var Sub = function VueComponent (options) {
3916 this._init(options);
3917 };
3918 Sub.prototype = Object.create(Super.prototype);
3919 Sub.prototype.constructor = Sub;
3920 Sub.cid = cid++;
3921 Sub.options = mergeOptions(
3922 Super.options,
3923 extendOptions
3924 );
3925 Sub['super'] = Super;
3926
3927 // For props and computed properties, we define the proxy getters on
3928 // the Vue instances at extension time, on the extended prototype. This
3929 // avoids Object.defineProperty calls for each instance created.
3930 if (Sub.options.props) {
3931 initProps$1(Sub);
3932 }
3933 if (Sub.options.computed) {
3934 initComputed$1(Sub);
3935 }
3936
3937 // allow further extension/mixin/plugin usage
3938 Sub.extend = Super.extend;
3939 Sub.mixin = Super.mixin;
3940 Sub.use = Super.use;

Callers 1

initGlobalAPIFunction · 0.70

Calls 5

mergeOptionsFunction · 0.70
initProps$1Function · 0.70
initComputed$1Function · 0.70
extendFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected