Created
June 14, 2016 08:20
-
-
Save radjivF/8f4a8005a228dc5b6ff308b1a0e7af6b to your computer and use it in GitHub Desktop.
conditional promise in coffeescript
This file contains 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
conditional = true | |
promises_list = [] | |
if conditional? | |
#if conditional is true run this promises | |
p.push Promise.conditional conditional | |
p.push Promise.normal | |
Promise.all p | |
.then (output) -> | |
conditional_result = output.conditional_result | |
if conditional_result | |
console.log 'this the result of the conditional promise | |
console.log 'this the result of the normal promise | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment