Last active
March 7, 2017 09:25
-
-
Save toddzebert/ef155ae58efb5a3788a7b143b0f7d215 to your computer and use it in GitHub Desktop.
"async" partial application functions for callback w/"all" 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
// requires https://gist.github.com/toddzebert/95bcc9b50febad0bb9680d3eab897797 | |
// requires https://gist.github.com/toddzebert/b4465de41b0f8d317d7a685604983c36 | |
var getAuth = asyncSim.bind(null, 'Authorized'); | |
var getProfile = asyncSim.bind(null, 'Profile'); | |
var getFeed = asyncSim.bind(null, function(data) { | |
for (var a = [], i = randInt(4, 2); i; i--) { | |
a.push(randInt(90, 1)); | |
} | |
return a; | |
}); | |
var getPost = function(post) { | |
return asyncSim.bind(null, function(data) { | |
posts[post] = post + 100; | |
return post + 100; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment