Skip to content

danheberden/jquery-whenSet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

whenSet - a jQuery and Underscore Deferred Plugin

Create a deferred for all arguments independently and exposes iterative methods, such as doneEach and failEach as well as a deferred for all objects as a set.

Note - use with underscore requires the underscore.Deferred plugin by Sam Breed.

Getting Started

Download the production version or the development version.

Example:

    $.whenSet( anAsyncFunction, anotherAsyncFunction )
     .doneEach( function( result ){
       console.log( result, ' just finished' );
     })
     .done( function( resultA, resultB ){
       console.log( 'all done!' );
     });

Using with Underscore.js

    _.whenSet( anAsyncFunction, anotherAsyncFunction )
     .doneEach( function( result ){
       console.log( result, ' just finished' );
     })
     .done( function( resultA, resultB ){
       console.log( 'all done!' );
     });

The returned promise will has the doneEach, failEach, alwaysEach, pipeEach exposed as well as putting the arguments onto one promise as an array, like [0] => arg1, [1] => arg2, etc.

Here's a demo: http://jsfiddle.net/danheberden/YRB4P/

How Big Is it?

366 bytes min'd and gzip'd

Contributing

Moar unit tests

Release History

v1.0.0 - used grunt to make awesome

v0.0.1 - initial release

License

Copyright (c) 2012 Dan Heberden Licensed under the MIT license.

About

$.when with each functions, like doneEach

Resources

License

Stars

Watchers

Forks

Packages

No packages published