[20190807] 回调函数与promise的写法

 回调函数的写法:

asyncFunction1(callback){
    // ...
    asyncFunction2(callback){
        // ...
        asuncFunction3(callback){
            // ...
        }
    }
}

promise的写法 

promise1
.then(
    // ...
    return promise2
)
.then(
    // ..
    return promise3
)
.then(
    // ..
)

 或者

Promise.all([promise1,promise2,promise3])
.then(
    // ...
)

猜你喜欢

转载自www.cnblogs.com/jimfigo/p/11316714.html