How To Synchronise Promise Objects?
问题 I have promise objects which need to work synchronize. For example second promise shouldn't work before first one is done. If first one rejects first one has to be executed again. I have implemented some examples.This one works well. call getVal, wait 2000ms, return, i++, again call getVal ..... getVal() { return new Promise(function(resolve, reject) { setTimeout(function(){ resolve(19) }, 2000); }); } async promiseController(){ for(var i =0;i<5;i++) { var _val = await this.getVal() console