javascript -- Promise 多个异步链调用
2017-09-07 本文已影响4人
反者道之动001
then
function t(){
return new Promise((resolve, reject)=>{
setTimeout(()=>{
resolve(0)
},1000)
})
}
function t1(){
return new Promise((resolve, reject)=>{
setTimeout(()=>{
resolve(1)
},2000)
})
}
t().then((e)=>{
console.log(e)
return t1()
}).then((e)=>{
console.log(e)
})