Skip to content

ECMAScript Promise chains

ythy edited this page Aug 25, 2017 · 3 revisions

案例: 通过 getData()方法获取初始数据, 方法返回后调用下一相应方法 getSpecInfo()

getData():void{
  mBusinessBase.call(MProcurementServletKey.SearchGBMallItemDetail)
  .then((json:UJsonRespond)=>{
    ...do something
    return this.getSpecInfo();
  })
  .then((json:UJsonRespond)=>{
    ...do something
  });
}
    
getSpecInfo():Promise<UJsonRespond>{  
  return mBusinessBase.call(MProcurementServletKey.SearchItemPriceAndQuantityInfo); 
}
Clone this wiki locally