Fix "Coming from jQuery" wiki page #182

Closed
rkatic opened this Issue Jan 27, 2013 · 17 comments

Projects

None yet

4 participants

@rkatic
Collaborator

As of jQuery 1.8, the deferred.then() method returns a new promise (http://api.jquery.com/deferred.then/)

To fix: https://github.com/kriskowal/q/wiki/Coming-from-jQuery

@domenic
Collaborator

It's a wiki, you can edit it too :)

@rkatic
Collaborator

It is not a small fix, and English is not my first language, so will leave this one to you guys ;)

@kriskowal
Owner

Awesome, been waiting for that bit of good news. I wonder which callback resolves the returned promise if you provide more than one fulfillment or rejection handler.

@rkatic
Collaborator

Not sure what you mean, but the returned promise from callbacks will be used to forward the resolution...

@domenic
Collaborator

@rkatic I think @kriskowal is referring to this signature:

deferred.then( doneCallbacks, failCallbacks )
@rkatic
Collaborator

If the promise is fulfilled then the doneCallbacks resolves, if rejected then failCallbacks. But still unsure what you mean..

EDIT: I see now the plural :) I suspect it is an error in theirs documentation.

@domenic
Collaborator

Like, what is the result of:

$.when(5)
  .then([function (x) { return x + 1; }, function (x) { return x + 2; }])
  .then(function (y) { console.log(y); });

Does 6 or 7 get logged?

@rkatic
Collaborator

Where you found the deferred.then( doneCallbacks, failCallbacks ) signature?

@domenic
Collaborator

In the link you gave

@rkatic
Collaborator

Yes, I see, but it is removed in 1.8 :)

@domenic
Collaborator

Oh, nice, thanks for guiding me to that :)

@rkatic
Collaborator

No problem.

@cowwoc

I believe the only way to mix q.js and JQuery 1.8+ is using Q.defer(). Am I wrong?

If this is the case, you can pretty much eliminate the Wiki page and replace it with a short note to that effect.

@domenic
Collaborator

@cowwoc The wiki page is not about how to mix them (in which case you would probably use Q, not Q.defer); it's about teaching people who have used jQuery promises what the differences are between them and Q promises.

@kriskowal
Owner

It’s also grossly inaccurate now, and should be rewritten entirely.

@domenic
Collaborator

Somehow, I got inspired: https://github.com/kriskowal/q/wiki/Coming-from-jQuery

Fixes welcome!

@domenic domenic closed this Sep 26, 2013
@kriskowal
Owner

Damn, @domenic. You killed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment