Closed endeepak closed 13 years ago
I very recently received another suggestion for a solution to this problem in which calls to MULTI could include an identifier so that the next method in the flow would receive the MULTI results as key/value pairs rather than as an arbitrarily ordered array. In some ways, that seems like a more clean solution... or at least more in line with the style of flow-js, but I have had limited time to give it any thought. I'm interested to hear your reaction/argument for why this callback style would be better. (Obviously, the fact that you have already taken the time to implement it is a real advantage!)
I hadn't thought of that approach. I definitely agree that passing identifier to multi is more cleaner approach and is inline with the flow-js style.
It would be great to see this implemented in near future. Please let me know if you need any help, i can change the code to use this approach and send a pull request for the same.
I have changed the code to use an identifier for multi call as discussed above.
Adding callback support to MULTI, so that return value of a async MULTI function can be processed without depending on the order of arguments in final step.
This is very useful when we have to process the value returned from async call. In our case we had to call multiple services(using jQuery.getJSON) and process the records returned by both services.
I have added test for this and updated the README with an example.