fixes
This commit is contained in:
parent
18e3b13fdc
commit
15a4048730
1 changed files with 15 additions and 5 deletions
20
main.js
20
main.js
|
@ -27,6 +27,8 @@ const pools = {
|
|||
|
||||
};
|
||||
|
||||
const stears = [];
|
||||
|
||||
/** Stear class */
|
||||
export class Stear{
|
||||
|
||||
|
@ -42,6 +44,13 @@ export class Stear{
|
|||
constructor(elem){
|
||||
this.elem = elem;
|
||||
elem.style.position="relative";
|
||||
stears.push(this);
|
||||
}
|
||||
destroy(){
|
||||
let i = stears.indexOf(this);
|
||||
if(i==-1) return;
|
||||
stears.splice(i,1);
|
||||
delete this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,7 +213,7 @@ ${Object.entries(json).map(d => " " + toCssAttr(d[0]) + ": " + d[1] + ";").jo
|
|||
Object.entries(pools).forEach(([k, d]) => {
|
||||
d.lang = lang;
|
||||
});
|
||||
this.globalRenderRequest();
|
||||
stears.forEach(s=>s.rerenderGlobal());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -587,15 +596,16 @@ export class class_ {
|
|||
*/
|
||||
get render (){
|
||||
if (!this.#doBuild) return this.#elem;
|
||||
this.#elem.innerHTML = "";
|
||||
let out = [];
|
||||
for (let i = 0; i < this.#build.length; i++) {
|
||||
const elem = this.#build[i];
|
||||
if (typeof elem == "string" || elem instanceof LanguagePoolString) {
|
||||
this.#elem.appendChild(document.createTextNode(String(elem)));
|
||||
out[i] = document.createTextNode(String(elem));
|
||||
} else {
|
||||
this.#elem.appendChild(elem.render);
|
||||
}
|
||||
out[i] = elem.render;
|
||||
}
|
||||
}
|
||||
this.#elem.replaceChildren(...out);
|
||||
return this.#elem;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue