1.0.0 • Published 3 years ago
promise-wsld v1.0.0
promise-ws
链式调用,解决回调地狱
install
npm install -g promise-wsld
#github https://gitee.com/HanShanShuiDi/promise-ws.git
#usage const MyPromise = require('./index.js') var p = new MyPromise((resolve,reject)=>{ setTimeout(()=>{ resolve(2) },1000) }) // then可以传成功失败函数,catch只能传失败函数 p.then(res=>{ console.log('resolve结果返回:', res) },err=>{ console.log('then错误结果分析:', err) }).catch(res=>{ console.log('catch错误结果分析:', res) })
1.0.0
3 years ago