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

@@ -196,8 +196,24 @@ export abstract 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))
@@ -212,18 +228,11 @@ export abstract 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)
}
}
private onRenderFinished() {