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 | |
var getAd = (function (dat) { | |
let i = 1; | |
// create a closure | |
const ad = function () { | |
return 'Ad#' + i++; | |
}; | |
return function (dat) { | |
return simAsync(ad); | |
}; |
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); |
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/135578e9faf006b73656c360b7e616e2 | |
// requires https://gist.github.com/toddzebert/c9d75cd901897e7363bf142a90a2b2a1 | |
// requires https://gist.github.com/toddzebert/bcd849a48676256eef8a795f8f03cfff | |
// requires https://gist.github.com/toddzebert/43c308b0e0f559b47ac487dcc8c06924 | |
// requires https://gist.github.com/toddzebert/5d279f8a2104bef103273e5177ae3599 | |
var data = { id: 4 }; | |
getAuth(data) | |
.then(getProfile) | |
.then(getFeed) | |
.then(getPosts) |
OlderNewer