Both are based on the Promises/A standard and implement a then method (though only current jQuery, they once had a incompatible pipe instead of then). However, there are a few differences:
- Q has exception handling. All thrown errors in the async
thencallbacks will be caught and reject the promise (and will only get re-thrown if you call.end()). Not sure whether I personally like that. It’s the standardized way which jQuery does not follow, rejecting fromthenin jQuery deferreds is much more complicated. - Q promises are resolved with a single value/reason (like you return/throw it from
then), while jQuery allows multiple arguments inresolve/rejectcalls on its Deferreds. - Q has lots of Proxy methods which will allow you to modifiy future values
- Q has
.alland similiar, which are more complicated with jQuery ($.when.apply($, […])). - Q does explicitly work with ticks in the event loop and guarantees asynchronity, while jQuery can be synchronous as well. This is now required by the Promises A/+ specification.
… which is basically Promises/B. As you can see, the Q API is more powerful, and (imho) better designed. Depending on what you want to do, Q could be the better choice, but maybe jQuery (especially if already included) is enough.