Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback Support to MULTI #2

Merged
merged 2 commits into from May 12, 2011
Merged

Callback Support to MULTI #2

merged 2 commits into from May 12, 2011

Conversation

endeepak
Copy link
Contributor

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.

…TI function can be processed without depending on the order of arguments in final step.
@willconant
Copy link
Owner

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!)

@endeepak
Copy link
Contributor Author

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.

@endeepak
Copy link
Contributor Author

endeepak commented May 7, 2011

I have changed the code to use an identifier for multi call as discussed above.

willconant added a commit that referenced this pull request May 12, 2011
callbacks generated by MULTI can include an identifier which can subsequently be used to distinguish results
@willconant willconant merged commit d11311b into willconant:master May 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants