Update 2 (2015/10/23) I realised I should really put an update on this post, at this point you should really not use Deferred and instead of jQuery or any other 3rd party library just start relying on the native ES6 / ES2015 Promise – unless you need some advanced functionality, in which case try something like Bluebird.

I gave an introductory talk a while back at the London Ajax User Group about jQuery Promises after which there was a lively debate, so I thought it would be great to post the content of the slides with some notes as a sort of tutorial.

Update (2012/09/01): As it turns out there was a nice video recorded of the talk, if you have 10 minutes free give it a watch!

And finally it must be said that jQuery Deferred is by far not the only one, see Promises/A spec and the clarified Promises/A+ spec. If you’re not already using jQuery then Q, rsvp.js or when might be better alternatives with seamless interoperability due to stricter adherence to the CommonJS specs.

Got a really handy bit of script working today, but it took me some time to figure out so thought I should post it.

Using the latest Jasmine Gem (only on Github master as of 2013/01/29) you just need to create spec/javascripts/support/jasmine_helper.rb and drop this in there (note that jasmine_helper.rb takes the responsibility of custom configs over from jasmine_config.rb from now on!):

What it does is to load assets.yml, parse the YAML array javascripts: workspace:, uses Jasmine’s PathExpander.expand method to actually glob the files from the paths listed there and finally wraps the whole thing into a lambda so that it acts as a method.