Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Wait for multiple promises to "be done" #2

Open
vespakoen opened this issue Jan 10, 2014 · 5 comments
Open

Wait for multiple promises to "be done" #2

vespakoen opened this issue Jan 10, 2014 · 5 comments
Assignees

Comments

@vespakoen
Copy link

Hi there!

In other promise libraries I was able to do something like:

$.when($.ajax( "api/pages" ), $.ajax( "api/pagecategories" )).done(function(pages, categories));

Is this possible with futuristic?
If not, are there any plans to add this in?

@seanlilmateus
Copy link
Owner

@vespakoen this is something that I wanted since the beginning, but I was not comfortable with the results after implementing it.
I'll implement it on the next release. at the moment I'm rewriting this gem. sorting out things that didn't work out as I wanted.

@seanlilmateus
Copy link
Owner

@vespakoen I have a new branch Version 1.0, on this branch the feature you're looking is implemented. but I changed a lot on the design. At the moment I'm trying to document everything.

@seanlilmateus seanlilmateus self-assigned this Feb 17, 2014
@matthewsinclair
Copy link

Hi, just chiming in here - have you ever thought if it might be possible to use Futuristic promises with AFMotion? It'd be awesome if I could encapsulate an AFMotion request behind a promise (or future) so that the block called when the AFMotion request finishes ends up 'completing' the promise. Is that something you have considered? It'd make a whole lot of back-end interaction code (for example, with a RESTful API) so much easier to write, and profoundly more readable as code.

@seanlilmateus
Copy link
Owner

@matthewsinclair this is one of features the new branch introduces. You will be able to use Promises to accomplish this kind of thing and even react to error. Tonight will be working on the specs and documentation.

e.g: https://github.com/seanlilmateus/futuristic/blob/version_1_0/lib/futuristic/future.rb#L6-L15

@matthewsinclair
Copy link

That sounds brilliant. I think that pattern will radically simplify the code for a lot of network / async operations. Thanks!

On 18 Feb 2014, at 7:05 pm, Mateus [email protected] wrote:

@matthewsinclair this is one of features the new branch introduces. You will be able to use Promises to accomplish this kind of thing and even react to error. Tonight will be working on the specs and documentation.


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants