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

 回调函数的写法:

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

 

promise的写法 

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

 或者

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

 

posted @ 2019-08-07 17:57  dengjuncong  阅读(506)  评论(0)    收藏  举报