Skip to content

Instantly share code, notes, and snippets.

@toddzebert
Last active March 7, 2017 09:25
Show Gist options
  • Save toddzebert/ef155ae58efb5a3788a7b143b0f7d215 to your computer and use it in GitHub Desktop.
Save toddzebert/ef155ae58efb5a3788a7b143b0f7d215 to your computer and use it in GitHub Desktop.
"async" partial application functions for callback w/"all" example
// 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