These functions are based on Mixu's Node Book chapter 7. Control flow. They sure can be optimized and this readme file needs to be more thorough. This repository contains asFlow.js for use on clients, a node module and files for testing.
What I wanted with this library was to make easy to understand functions that control three types of asynchronous flow and only these three. Please feel free to make them faster and more reliable but keep them as readable as possible. My goal is for users new to these functions, to be able to use them without ever reading the Readme.md ...
1. CREATE YOUR FUNCTIONS
var// Your code...callcurrentResults; // Returns and array of collected results at the moment sortet as the list of functionscallparentResult; // Returns the result passed by the function above current in the list of functionscallresultByFunctioni; // Returns specific result from a function in the list of functionscallbackoptionalResult; // Is required to be executed when the function returns and will deliver the result to the// list of results;
2. ADD THEM TO THE LIST
var functions =function0function1 argument0 argument1 argumentN // Adding a optional list of arguments to function1function3function4function5 argument0 argument1 argumentN // Adding a optional list of arguments to function5;
3. RUN THE LIST OF FUNCTIONS IN ONE OF THESE THREE FLOW FUNCTIONS
var// Fires when the flow has completed and gives you a list with the results sorted as you sorted the// the list of functions.;asFlowserialExecutefunctions optionalCallback;asFlowparallelExecutefunctions optionalCallback;asFlowparallelExecute_withLimitfunctions 3 optionalCallback;