hedera-web/js/vn/mutators.js

45 lines
989 B
JavaScript

vnCustomTags = {};
const Mutators = Class.Mutators;
const _Extends = Mutators.Extends;
Mutators.Extends = function() {
_Extends.apply(this, arguments);
this.implement({Properties: {}});
}
Mutators.Tag = function(tagName) {
vnCustomTags[tagName] = this;
this.extend({Tag: tagName});
const parent = this.parent;
if (parent && parent.Classes !== undefined) {
let Classes = tagName
if (parent.Classes !== '')
Classes += ' '+ parent.Classes;
this.extend({Classes});
}
};
Mutators.Properties = function(props) {
let parentProps;
for (const propName in props) {
const prop = props[propName];
prop.configurable = true;
if (!prop.get && !prop.set && prop.writable === undefined)
prop.writable = true;
}
if (this.parent && (parentProps = this.parent.Properties))
for (const propName in parentProps)
if (!props[propName])
props[propName] = parentProps[propName];
this.extend({Properties: props});
Object.defineProperties(this.prototype, props);
};