小程序如何让index-onShow()的功能函数,运行在app-onShow()之后

小程序如何让index-onShow()的功能函数,运行在app-onShow()之后
官网这个方法应该不行:https://developers.weixin.qq.com/community/develop/doc/0002c8ec448280505e59fe4595b800
我用下面的办法

app.js
onShow()
{
   let that = this;
   that.globalData.isCheck=true;
   that.appCallBack && that.appCallBack()
   that.appCallBack = function(){}
   //var timeOut = setTimeout(function () {
   //},3000)
}

index.js
onShow()
{
   if (app.globalData.isCheck == true){
        console.log("app.js Run First");
   }else{
      app.appCallBack = function(){
	    console.log("Do I want do.");
	  }
   }
}
原文地址:https://www.cnblogs.com/bugutian/p/12357674.html