promise链式写法

    let a = () => {
        return new Promise(resolve => {
            console.warn('promise a start')
            resolve('P-a finished')
        })
    }
    let b = (parms) => {
        return new Promise(resolve => {
            console.warn(parms)
            resolve('P-b finished')
        })
    }
    let c = (parms) => {
        return new Promise(resolve => {
            console.warn(parms)
            resolve('P-c finished')
        })
    }
    a().then(b).then(c).then(res => console.warn(res))

你可能感兴趣的:(promise链式写法)