From f2822f219f036fe4b347a780f97e474081cd917d Mon Sep 17 00:00:00 2001 From: jusax23 Date: Fri, 10 Jun 2022 23:47:39 +0200 Subject: [PATCH] find in render --- main.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index eb38b92..734a1bd 100644 --- a/main.js +++ b/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._);