promise链式调用

//不了解promise可以先去看看,了解后再来相信大家读能看的懂
function Promise1(resolve, reject) {
setTimeout(function() {
resolve('1');
},5000);
}

function Promise2(resolve, reject) {
setTimeout(function() {
resolve('2');
},5000);
}

function Promise3(resolve) {
setTimeout(function() {
resolve('3');
},5000);
}
new Promise(Promise1).then(function(val){
console.log(val);
return new Promise(Promise2);
}).then(function(val){
console.log(val);
return new Promise(Promise3);
}).then(function(val){
console.log(val);
});
原文地址:https://www.cnblogs.com/zou1234/p/8723955.html