Use dedicated XmlComponent rather than polute pure one

This commit is contained in:
Dolan
2018-09-17 20:22:11 +01:00
parent c5b004166d
commit b6bd532295
5 changed files with 18 additions and 6 deletions

View File

@ -3,3 +3,4 @@ export * from "./attributes";
export * from "./default-attributes";
export * from "./imported-xml-component";
export * from "./xmlable-object";
export * from "./initializable-xml-component";

View File

@ -0,0 +1,11 @@
import { XmlComponent } from "file/xml-components";
export abstract class InitializableXmlComponent extends XmlComponent {
constructor(rootKey: string, initComponent?: InitializableXmlComponent) {
super(rootKey);
if (initComponent) {
this.root = initComponent.root;
}
}
}

View File

@ -5,9 +5,9 @@ export { BaseXmlComponent };
export abstract class XmlComponent extends BaseXmlComponent {
protected root: Array<BaseXmlComponent | string>;
constructor(rootKey: string, initContent?: XmlComponent) {
constructor(rootKey: string) {
super(rootKey);
this.root = initContent ? initContent.root : new Array<BaseXmlComponent>();
this.root = new Array<BaseXmlComponent>();
}
public prepForXml(): IXmlableObject {