How to work with non-deterministic number jQuery promises?

If I generate a non-deterministic number of promises, how do I treat them as a group to make sure that all of the promises in the group were resolved before I go into my code?

Although Iโ€™m talking about using it jQuery.when, it looks like it requires a deterministic number of promises passed as arguments. I thought I could pass an array of promises for processing, but based on documents that I think will evaluate this array as the only promise made.

+5
source share
1 answer

push all promises into an array and use:

$.when.apply(null, promiseArray).done(function() {....
+3
source

All Articles