hedera-web/js/vn/mutators.js

46 lines
936 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
vnCustomTags = {};
var Mutators = Class.Mutators;
2018-01-16 16:26:37 +00:00
var _Extends = Mutators.Extends;
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-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-05-30 01:30:33 +00:00
Mutators.Properties = function(props) {
var parentProps;
2022-05-30 01:30:33 +00:00
for (var propName in props) {
var 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))
for (var 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);
};
2022-05-30 01:30:33 +00:00
Mutators.Parent = function(propName) {
this.extend({Parent: propName});
};
2022-05-30 01:30:33 +00:00
Mutators.Child = function(propName) {
this.extend({Child: propName});
};