【发布时间】:2016-12-21 17:17:05
【问题描述】:
fetch() {
return axios.get('/rest/foo')
//.then(response => {throw new Error(response)}) // Uncomment to test network error
//.then( <<add delay here>> ) // Uncomment to simulate network delay
}
如何在后者中添加延迟然后阻塞,以便在将控制权传递给 fetch 调用者然后阻塞之前等待指定的时间量?
【问题讨论】:
标签: javascript asynchronous callback promise