50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
|
import { IgniteProperty } from './ignite-html.js';
|
||
|
import { IgniteTemplate } from './ignite-template.js';
|
||
|
|
||
|
class IgniteElement extends HTMLElement {
|
||
|
constructor() {
|
||
|
super();
|
||
|
|
||
|
this.template = null;
|
||
|
this.createProperties();
|
||
|
}
|
||
|
|
||
|
properties() {
|
||
|
return [];
|
||
|
}
|
||
|
|
||
|
createProperties() {
|
||
|
var props = this.properties();
|
||
|
|
||
|
for (var i = 0; i < props.length; i++) {
|
||
|
this[`_${props[i]}`] = new IgniteProperty();
|
||
|
|
||
|
((propName) => {
|
||
|
Object.defineProperty(this, propName, {
|
||
|
get: function () {
|
||
|
return this[`_${propName}`];
|
||
|
},
|
||
|
|
||
|
set: function (value) {
|
||
|
this[`_${propName}`].value = value;
|
||
|
}
|
||
|
});
|
||
|
})(props[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
connectedCallback() {
|
||
|
this.template = new IgniteTemplate();
|
||
|
this.template.element = this;
|
||
|
|
||
|
this.render().construct(this);
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
IgniteElement
|
||
|
};
|