Looking at the documentation for Parse.Promise.when (https://www.parse.com/docs/js/symbols/Parse.Promise.html#.when), currently, there are two ways of specifying it. The first is with comma separated input parameters for "when" and followed by comma separated inputs for the function in "then"
Parse.Promise.when(p1, p2, p3).then(function(r1, r2, r3) {
console.log(r1); // prints 1
console.log(r2); // prints 2
console.log(r3); // prints 3
});
and the Second is with an array input for "when" followed by comma separated inputs for the function in "then."
var promises = [p1, p2, p3];
Parse.Promise.when(promises).then(function(r1, r2, r3) {
console.log(r1); // prints 1
console.log(r2); // prints 2
console.log(r3); // prints 3
});
My question is: For the function inside "then," is there a easy way to specify an infinite amount of inputs without actually having to put in an infinite amount of inputs? In other words, is there a way to reproduce this in a simple way?
var promises = [p1, p2, p3];
Parse.Promise.when(promises).then(function(r1, r2, r3,.............∞) {
console.log(r1); // prints 1
console.log(r2); // prints 2
console.log(r3); // prints 3
.
.
.
.
.
∞
});
I tried using the "arguments" variable but it does not work in this case. It seems I have to put in one by one the parameters r1,r2,r3...∞. Does anyone know a way around this? Please help