sudhirj/simply-deferred — pull request #10 by levic (2013-04-11 10:07:00+00:00)
Title: always()/when() functions invoked in different order to jquery

Jquery's implementation of `.always()` is just a shorthand for adding to both the done and fail queues:
```
...
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
...
```

simply-deferred maintains a 3rd queue of `alwaysCallbacks`. These are invoked after the `done` and `fail` callbacks. This causes functions to be invoked in a different order to jquery.

Attached patch copies the jquery behaviour. Apologies no new test case -- coffeescript + async/deferred code hurts my head at this time of night. The linked jsfiddles are regular JS tests that demonstrate the bug (and test `.when()` too) -- attached patch fixes it).

JQuery: http://jsfiddle.net/6WSWS/2/
Simply Deferred: http://jsfiddle.net/hHp9C/1/