I'm new to the when.js
javascript library, but I'm familiar with async programming in C#. That's why I find this code to be unwieldy:
filters.doFilter('filter1name', reqAndPosts).then(function(filter1) {
filters.doFilter('filter2name', filter1).then(function(filter2) {
filters.doFilter('filter3name', filter2).then(function (posts) {
renderView(posts);
});
});
return filter1;
});
I basically want three methods to be called in sequence, with the output of each being piped to the next method. Is there anyway I can refactor this code to be more "sequence-like" - i.e. get rid of the nesting? I feel like there's something I'm missing with the when
-framework here. I'm not doing it right, right?