find in render
This commit is contained in:
parent
3994dc115f
commit
f2822f219f
1 changed files with 8 additions and 6 deletions
14
main.js
14
main.js
|
@ -72,6 +72,7 @@ export class SFrame{
|
|||
#preRender;
|
||||
#render;
|
||||
#call;
|
||||
#find = {};
|
||||
|
||||
#lastRender;
|
||||
constructor({ preRender, render, call }){
|
||||
|
@ -84,8 +85,10 @@ export class SFrame{
|
|||
}
|
||||
|
||||
render(args={}){
|
||||
this.#lastRender = this.#render({}, args);
|
||||
this.#lastRender = this.#render({ find: this.#find }, args);
|
||||
this.#lastRender.render;
|
||||
for (var member in this.#find) delete this.#find[member];
|
||||
Object.assign(this.#find, this.#lastRender.find);
|
||||
return this.#lastRender;
|
||||
}
|
||||
|
||||
|
@ -94,18 +97,17 @@ export class SFrame{
|
|||
stear.elem.appendChild(this.#lastRender._);
|
||||
this.#lastRender._.style.zIndex = layer;
|
||||
}
|
||||
var find = (this.#lastRender?.find) ?? {};
|
||||
return new Promise((res,rej)=>{
|
||||
this.#call(stear,{
|
||||
find,
|
||||
find: this.#find,
|
||||
render: (args) => {
|
||||
this.render(args);
|
||||
for (var member in find) delete find[member];
|
||||
Object.assign(find, (this.#lastRender?.find) ?? {});
|
||||
/*for (var member in find) delete find[member];
|
||||
Object.assign(find, (this.#lastRender?.find) ?? {});*/
|
||||
if ([...(stear.elem.children)].indexOf(this.#lastRender._) >= 0) stear.elem.removeChild(this.#lastRender._);
|
||||
stear.elem.appendChild(this.#lastRender._);
|
||||
this.#lastRender._.style.zIndex = layer;
|
||||
return find;
|
||||
return this.#find;
|
||||
},
|
||||
resolve: (r,close=true)=>{
|
||||
if (close&&this.#lastRender&&[...(stear.elem.children)].indexOf(this.#lastRender._) >= 0) stear.elem.removeChild(this.#lastRender._);
|
||||
|
|
Loading…
Reference in a new issue