News for hackers. Stuff that matters.
Re:Using Deferreds in jQuery 1.5 by dhimes on Monday January 31, 2011 @05:07PM (#2163404)
For a single ajax request this doesn't save much (just call the functions you need to call from the success() method). In fact, if used poorly it may obfuscate the program flow. However, the "when" example looks interesting. I'm new to JS and JQ, so I haven't run into that problem yet (and known it!), but at this point I would have to, for each ajax query, set some sort of "state" bool and call the function I want to run. Only when all the bools were set to true- meaning all calls found success- would the function execute. The "when" approach is much more elegant.
Re:Using Deferreds in jQuery 1.5 by wahnfrieden on Monday January 31, 2011 @10:23PM (#2164288)
You might also be interested to know that Dojo has DeferredList for tracking several Deferred objects (the equivalent of jQuery promises). The DeferredList is itself a Deferred which is activated once all the Deferreds in it execute.