[whatwg] Promise.every() arguments

Tab Atkins Jr. jackalmage at gmail.com
Tue Aug 20 14:00:29 PDT 2013

On Tue, Aug 20, 2013 at 1:42 PM, Alec Flett <alecflett at chromium.org> wrote:
> I've been doing a lot of experimentation with Promises using the Blink
> implementation. I've frequently hit an issue with the .every() / .any() /
> .some()
> the problem is that they support a variable number of arguments. This seems
> very developer friendly in theory, as per the docs:
> Promise.every(fetchJSON(foo), fetchJSON(bar), fetchJSON(baz));
> This is great the first time you play with it on your local developer
> console.
> The problem arises in practice: it's very common to build up arrays of N
> promises, and then tie them all together. Even if your own API uses
> varargs, using Promise.every breaks down.

ES6 has array spreading, so you can do `Promise.every(...pending)`.
This already works in Firefox, and V8 (Chrome's JS engine) is adding
these kinds of features as well.


More information about the whatwg mailing list