真实世界的 Promise async await 实践
作者:
Apolo_Du | 来源:发表于
2018-07-28 15:57 被阅读1次
let {Life, RealWorldSkills} = RealWorld
let man = new Life('male')
let {makeFriendsWith} = RealWorldSkills
let {forget} = RealWorldSkills
function haveFunWith(girl){
dateWith(girl)
.then(makeHerShameful)
.then(takeHerKiss)
}
makeFriendsWith = makeFriendsWith.bind(man)
haveFunWith = haveFunWith.bind(man)
forget = forget.bind(man)
man.on('girlClosingIn', (girl)=>{
async function relationshipPromoted(){
return makeFriendsWith(girl)
}
await relationshipPromoted()
.then(haveFunWith)
.catch(forget)
})
本文标题:真实世界的 Promise async await 实践
本文链接:https://www.haomeiwen.com/subject/bpvomftx.html
网友评论