0

In working on my first SPA application based on John Papa's Hot Towel template, I ran across a note that suggest that Durandal uses jQuery promises, whereas all the other libraries in Hot Towel use Q for promises. Durandal does have a page that explains how to do the patch, but I found that my app works the same with and without it.

http://durandaljs.com/documentation/Q/

I have seen an comments on the advantages of Q, and I am sold on that, but I am wondering if patching Durandal is advised or not advised by those who are expert in this?

1 Answers1

0

tl;dr Q and jQuery are not interoperable

Rather than return a new promise jQuery mutates the existing one which is supposed to be immutable. Why does this matter? Because the $.then function is no longer chainable and error handling doesn't work the way you expected. It may be possible to make them work together in very simple cases but really you just shouldn't.

Another thing to note is that according to one of the jQuery developers for backwards compatibility reasons this will likely never be fixed.

This article does an excellent job explaining both the spec and the current state of jQuery promises.

Baer
  • 3,690
  • 25
  • 24