提交 27d7a37a 编写于 作者: K kirl75

xts_获取当前ability增加延时

Signed-off-by: Nkirl75 <kirl.liu@huawei.com>
上级 ecd0c185
......@@ -43,11 +43,12 @@ export default function abilityTest() {
var Subscriber;
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
function SubscribeCallBack(err, data) {
async function SubscribeCallBack(err, data) {
console.debug("ACTS_GetCurrentTopAbility_0100====>Subscribe CallBack data:====>"
+ JSON.stringify(data));
expect(data.event == 'GetCurrentTopAbilityB').assertTrue();
if (data.event == 'GetCurrentTopAbilityB') {
await sleep(1000);
AbilityDelegator.getCurrentTopAbility((err, data) => {
console.log("ACTS_GetCurrentTopAbility_0100 and");
console.debug("====>thisTopAbility_0100====>" + JSON.stringify(data));
......
......@@ -45,10 +45,11 @@ export default function abilityTest() {
var Subscriber;
var AbilityDelegator=await abilityDelegatorRegistry.getAbilityDelegator();
function SubscribeCallBack(err, data) {
async function SubscribeCallBack(err, data) {
console.debug("ACTS_GetCurrentTopAbility_0200====>Subscribe CallBack data:====>" + JSON.stringify(data));
expect(data.event == 'GetCurrentTopAbility').assertTrue();
if (data.event == 'GetCurrentTopAbility') {
await sleep(1000);
AbilityDelegator.getCurrentTopAbility((err,data) => {
console.debug("====>thisTopAbility====>"+JSON.stringify(data.lastRequestWant))
console.debug("====>start startAbility====>");
......
......@@ -44,12 +44,14 @@ export default class MainAbility3 extends Ability {
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility3 onForeground")
console.log("[Demo] MainAbility3 onForeground");
setTimeout(() => {
globalThis.abilitydelegator.getCurrentTopAbility().then((data)=>{
globalThis.ability3 = data
console.debug("====>MainAbility getCurrentTopAbility:====>" + JSON.stringify(globalThis.ability3));
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
})
}, 1000);
}
onBackground() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册