jQuery Deffereds and Resolution Values
If you pass multiple Deffered objects into a jQuery $.when()
call, the resolved values will all be passed as individual arguments to the then()
callback. Ex.
$.when(
$.Deferred(
function(deff){
deff.resolve(5);
}
),
$.Deferred(
function(deff){
deff.resolve(7);
}
)
).then(function(){
console.log(arguments);
});
Will output [5, 7]
in the console. So presumably the order is based on the order in which the Deffered objects were added to the when
list.
Written by mattcodez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#