31Jan

jQuery 1.5 released, has shiny Futures and Promises!

Posted by Elf Sternberg as Uncategorized

In case you’ve been under a rock, the jQuery team released version 1.5 this afternoon, and in a move that took me completely by surprise, jQuery 1.5 includes Futures and Promises. Well, that’s fine, but what the Heck are futures and promises?

A Promise is a proxy for a result that hasn’t arrived yet. In event-driven programming, such as browser-side development, this is huge. If you have several events that might happen in a non-determinate order, the callback might be a functor with a counter for the number of events to be aggregate into a “all done” event. With jQuery’s Deferred pattern, that gets reversed to

 $when( getSchemas(), getData() ).then(function({  app = new MyApplication(); }); 

How cool is that? Practical demos to follow as soon as I get my head around the whole API.

Comment Form

Subscribe to Feed

Categories

Calendar

January 2011
M T W T F S S
« Dec   Feb »
 12
3456789
10111213141516
17181920212223
24252627282930
31