Closed calvinmetcalf closed 10 years ago
Thanks a lot for your pull request, Calvin! Much appreciated!
I prefer the done callbacks as they do not alter the result coming from the original promise. I really hope that jQuery commits to implement the standard Promise behaviour, but even if it will, I'm quite sure that they will add their flavor to it, without breaking the specifications.
That'd mean that we'd need to add our own implementations of done / fail / always / progress
callbacks to remove jQuery dependency, but that should be only a few lines of code, and the jQuery community is still a major target group for us.
What do you think, is that reasonable? @svnlto
for reference purposes.. http://bugs.jquery.com/ticket/14510 http://bugs.jquery.com/roadmap
So this is attempting to sidestep the whole jquery vs real promise thing and just switch the examples to show something that is more recognizable as a promise. the jquery .then(onSuccess, onFailure);
works more or less like the the one in browsers. So switching the docs just makes it more recognizable that you are in facto returning promises and not just having a done method.
My point is, promise.done(doSomething).done(doSomethingElse)
is very different from promise.then(doSomething).then(doSomethingElse)
, as then
alters the return value of promise
. But if you both think that it makes the docs better, let's merge it.
oooo I see what you mean, but yes .then is a bit more recognizable and is going to be less confusing as there are other promise libraries that use done in an incompatible way.
We decided yesterday to make Hoodie promises standard compliant, and adding .done
, .fail
, .progress
methods with jQuery's signature.
I agree with you that .then
is more recognizable to developers that have a wider understanding of JavaScript, we want to promote the usage of .done
, .fail
, .progress
callbacks as they won't have any side effects.
Makes sense? I'm closing this pull request, but your input is still more then welcome, this is an ongoing discussion. See https://github.com/hoodiehq/hoodie.js/issues/311
in preparation for moving off jquery, switch the docs from using a jquery specific promise method to using one that jquery and others use