【发布时间】:2017-04-06 10:45:05
【问题描述】:
代码 -
.then (() => {
console.log("Wait");
setTimeout(function(){console.log("Wait to process")},1500);
this.timeout(2000);
})
.then(() => {
console.log("Get ABC");
return common.getApiData(url)})
现在,当我运行此代码时,它会记录以下数据 - 等待 获取ABC 等待处理 (它等待上面指定的时间)
我想在调用 getApiData 方法之前设置超时..
【问题讨论】:
-
这些是什么类型的?在 A+ Promise 的
then中传递的函数应该采用先前已解决的 Promise 的值并返回一个新的 Promise。
标签: node.js testing timeout wait