Created
November 30, 2017 07:36
-
-
Save ermst4r/1011e2c392645683328c32ac0b0b3b98 to your computer and use it in GitHub Desktop.
promise example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bid_type = method.populateBidType(bid); | |
var new_bid = bid.bid + 1; | |
Profilebot.generateRandomAutobotId(bid.fk_profile_bot_id).then(function (bot) { | |
return bot; | |
}).then(function (bot) { | |
var insert_data = ProfileBid.prepareInsertData(bid.fk_user_id, bot.bot_id, item.id, new_bid, bid_type); | |
return insert_data; | |
}).then(function (insert_data) { | |
return insert_data; | |
}).then(function (insert_data) { | |
// is deze chaining goed? | |
ActiveAuctionProfile.increaseProfileTime(item.id).then(function (res) { | |
resolve(res); | |
}).catch(function (reason) { | |
reject(reason); | |
}) | |
}).catch(function (reason) { | |
reject(reason); | |
}); |
Ook de gewrapte function moeten waarde return anders blijft die wachten
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1 keer catch is genoeg.
Maar elke promise moet altijd een return hebben.