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(){
}
学贵有恒,而行胜于言