Created
March 27, 2017 04:08
-
-
Save toddzebert/135578e9faf006b73656c360b7e616e2 to your computer and use it in GitHub Desktop.
getAds code for use with getAd.js, and simAsync.js
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
// requires https://gist.github.com/toddzebert/996e297c1c081d19378eaf5f29dc75bb | |
// requires https://gist.github.com/toddzebert/ec087188b813e6490abab2cf0feb2ad5 | |
var getAds = function (data) { | |
return new Promise( (resolve, reject) => { | |
Promise.race([getAd(data), getAd(data), getAd(data)]) | |
.then(result => { | |
data.ads = result; resolve(data); | |
}) | |
.catch(result => { | |
data.ads = result; reject(data); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment