move check id out of constructor

This commit is contained in:
Fabio Pliger
2022-04-22 12:55:06 -05:00
parent ea63e36ca1
commit 45d68f5701
3 changed files with 28 additions and 21 deletions

View File

@@ -45,9 +45,7 @@ export class BaseEvalElement extends HTMLElement {
this.shadow = this.attachShadow({ mode: 'open'});
this.wrapper = document.createElement('slot');
this.shadow.appendChild(this.wrapper);
if (!this.id)
this.id = this.constructor.name+"-"+guidGenerator()
}
}
addToOutput(s: string) {
this.outputElement.innerHTML += "<div>"+s+"</div>";
@@ -58,6 +56,11 @@ export class BaseEvalElement extends HTMLElement {
}
checkId(){
if (!this.id)
this.id = this.constructor.name+"-"+guidGenerator();
}
getSourceFromElement(): string{
return "";
}
@@ -165,6 +168,8 @@ export class BaseEvalElement extends HTMLElement {
} // end eval
}
function createWidget(name: string, code: string, klass: string){
class CustomWidget extends HTMLElement{