web:fix cannot execute hookAfter in web promise,use setTimeout instead

This commit is contained in:
pengfei.zhou
2021-04-13 18:28:45 +08:00
committed by osborn
parent ace3d30e73
commit 4873ff535d
18 changed files with 140 additions and 1640 deletions

View File

@@ -174,9 +174,26 @@ export class Panel {
}
}
}
if (this.__rendering__) {
//skip
Promise.all(promises).then(_ => {
});
}
else {
this.__rendering__ = true;
Promise.all(promises).then(_ => {
this.__rendering__ = false;
this.onRenderFinished();
});
}
}
else {
Promise.resolve().then(() => {
if (this.__rendering__) {
//skip
return;
}
this.__rendering__ = true;
Function("return this")().setTimeout(() => {
if (this.__root__.isDirty()) {
const model = this.__root__.toModel();
promises.push(this.nativeRender(model));
@@ -191,19 +208,11 @@ export class Panel {
}
}
}
});
}
if (this.__rendering__) {
//skip
Promise.all(promises).then(_ => {
});
}
else {
this.__rendering__ = true;
Promise.all(promises).then(_ => {
this.__rendering__ = false;
this.onRenderFinished();
});
Promise.all(promises).then(_ => {
this.onRenderFinished();
});
}, 0);
}
}
onRenderFinished() {