- resolved: in which case data is available
- rejected: in which case something went wrong and no value is available
- promise.then( function( futureValue ) {
- /* we got a value */
- } , function() {
- /* something went wrong */
- } );
- when(
- promise1,
- promise2,
- ...
- ).then(function( futureValue1, futureValue2, ... ) {
- /* all promises have completed and are resolved */
- });
- when(
- function(){
- /* animation 1 */
- /* return promise 1 */
- },
- function(){
- /* animation 2 */
- /* return promise 2 */
- }
- ).then(function(){
- /* once both animations have completed
- we can then run our additional logic */
- });
reference