Unconventional JavaScript Promises

The intermediate JavaScript developer has come across using promises for AJAX, and many have also used it when building animations, but not much more. I’d like to show you many other situations where using promises, although unconventional, will significantly increase the clarity of your code. I’ll explain how to make the Future/Promise/Deferred pattern first class in your application. Once you achieve that, it’s trivial to abstract away complex transformations and control flow in your code.

First, I will discuss using promises to manage web worker tasks and create a system to clearly express an fluent interface to web workers. After that I dive deep into complex use cases where using promises will significantly simplify actually applying business rules to your JavaScript application. After this, you might want your entire codebase to be deferred-ified, so maybe I’ll also add in some tips on how to convince your manager it’s a good idea. :-)

Watch this video on Oredev.org