未验证 提交 9f807d36 编写于 作者: O openharmony_ci 提交者: Gitee

!9900 修改时序问题导致abilitymonitor大概率失败

Merge pull request !9900 from songjindian/master
......@@ -15,6 +15,9 @@
import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
let TERMINATE_SELF_TIME = 2500;
let EVENT_TIME = 500;
function PublishCallBack() {
console.debug("====>Publish CallBack ====>");
}
......@@ -38,7 +41,7 @@ export default class MainAbility3 extends Ability {
globalThis.abilityContext.terminateSelf().then(()=>{
console.log("====>in terminateSelf====>");
})
},2000)
}, TERMINATE_SELF_TIME);
}
onWindowStageDestroy() {
......@@ -49,7 +52,9 @@ export default class MainAbility3 extends Ability {
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility3 onForeground")
commonEvent.publish("commonEvent_foreground", PublishCallBack);
setTimeout(()=>{
commonEvent.publish("commonEvent_foreground", PublishCallBack);
}, EVENT_TIME);
}
onBackground() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册