loading...

js - Promise

this.getBatchRequestResult().then(function(){
      //最后执行
}
batchRequest: function(method){
	return new Promise(function(resolve){
		setTimeout(function(){
			resolve(method)
		}, 400)
	})
},
				
getBatchRequestResult: function(){
	var requestQueue = []
	requestQueue.push(this.batchRequest(this.do()))
	return Promise.all(requestQueue)
}

//必须先执行的方法
do:function(){

}
posted @ 2020-12-28 15:21  robinloveslife  阅读(55)  评论(0编辑  收藏  举报