0
1
Fork 0
hedera-web-mindshore/js/vn/mutators.js

49 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
vnCustomTags = {};
2022-06-06 12:49:18 +00:00
const Mutators = Class.Mutators;
const _Extends = Mutators.Extends;
2018-01-16 16:26:37 +00:00
2022-05-30 01:30:33 +00:00
Mutators.Extends = function() {
_Extends.apply(this, arguments);
this.implement({Properties: {}});
2018-01-16 16:26:37 +00:00
}
2022-11-16 01:44:39 +00:00
Mutators.Template = function(template) {
this.extend({Template: template});
};
2022-05-30 01:30:33 +00:00
Mutators.Tag = function(tagName) {
2016-09-26 09:28:47 +00:00
vnCustomTags[tagName] = this;
2022-05-30 01:30:33 +00:00
this.extend({Tag: tagName});
2022-06-07 08:19:29 +00:00
2022-06-06 12:49:18 +00:00
const parent = this.parent;
if (parent && parent.Classes !== undefined) {
let Classes = tagName
if (parent.Classes !== '')
Classes += ' '+ parent.Classes;
this.extend({Classes});
}
};
2022-05-30 01:30:33 +00:00
Mutators.Properties = function(props) {
2022-06-06 12:49:18 +00:00
let parentProps;
2022-06-06 12:49:18 +00:00
for (const propName in props) {
const prop = props[propName];
2016-09-26 09:28:47 +00:00
prop.configurable = true;
if (!prop.get && !prop.set && prop.writable === undefined)
prop.writable = true;
}
if (this.parent && (parentProps = this.parent.Properties))
2022-06-06 12:49:18 +00:00
for (const propName in parentProps)
2016-09-26 09:28:47 +00:00
if (!props[propName])
props[propName] = parentProps[propName];
2022-05-30 01:30:33 +00:00
this.extend({Properties: props});
Object.defineProperties(this.prototype, props);
};