更新时间:2023-02-17 12:20:35
这有效:
doWork('task one')
.then(function() {
return doWork('task two')
})
.then(function() {
console.log('all done');
});
这是有道理的 - 只需直接调用 doWork
在然后()
将立即触发超时,而不是让Q有机会等到任务1
完成。
That makes sense - just calling doWork
directly in then()
will fire off the timeout immediately, instead of giving Q a chance to wait until task one
is complete.