Cleaned up code, added support for lists, classes, attributes, and more. Added more test code, everything appears to be working. More cleanup and testing is needed.

This commit is contained in:
2020-07-28 09:04:04 -07:00
parent 8f9ade2dbd
commit b591a42370
10 changed files with 619 additions and 12 deletions

50
src/ignite-element.js Normal file
View File

@ -0,0 +1,50 @@
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
};