MCPcopy
hub / github.com/HumanSignal/label-studio / initExtend

Function initExtend

docs/themes/htx/source/js/vue.js:4547–4618  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

4545 /* */
4546
4547 function initExtend(Vue) {
4548 /**
4549 * Each instance constructor, including Vue, has a unique
4550 * cid. This enables us to create wrapped "child
4551 * constructors" for prototypal inheritance and cache them.
4552 */
4553 Vue.cid = 0;
4554 var cid = 1;
4555
4556 /**
4557 * Class inheritance
4558 */
4559 Vue.extend = function(extendOptions) {
4560 extendOptions = extendOptions || {};
4561 var Super = this;
4562 var SuperId = Super.cid;
4563 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
4564 if (cachedCtors[SuperId]) {
4565 return cachedCtors[SuperId];
4566 }
4567
4568 var name = extendOptions.name || Super.options.name;
4569 if ("development" !== "production" && name) {
4570 validateComponentName(name);
4571 }
4572
4573 var Sub = function VueComponent(options) {
4574 this._init(options);
4575 };
4576 Sub.prototype = Object.create(Super.prototype);
4577 Sub.prototype.constructor = Sub;
4578 Sub.cid = cid++;
4579 Sub.options = mergeOptions(Super.options, extendOptions);
4580 Sub["super"] = Super;
4581
4582 // For props and computed properties, we define the proxy getters on
4583 // the Vue instances at extension time, on the extended prototype. This
4584 // avoids Object.defineProperty calls for each instance created.
4585 if (Sub.options.props) {
4586 initProps$1(Sub);
4587 }
4588 if (Sub.options.computed) {
4589 initComputed$1(Sub);
4590 }
4591
4592 // allow further extension/mixin/plugin usage
4593 Sub.extend = Super.extend;
4594 Sub.mixin = Super.mixin;
4595 Sub.use = Super.use;
4596
4597 // create asset registers, so extended classes
4598 // can have their private assets too.
4599 ASSET_TYPES.forEach(function(type) {
4600 Sub[type] = Super[type];
4601 });
4602 // enable recursive self-lookup
4603 if (name) {
4604 Sub.options.components[name] = Sub;

Callers 1

initGlobalAPIFunction · 0.85

Calls 6

validateComponentNameFunction · 0.85
mergeOptionsFunction · 0.85
initProps$1Function · 0.85
initComputed$1Function · 0.85
extendFunction · 0.70
createMethod · 0.45

Tested by

no test coverage detected