Re: [whatwg] Array as first argument to fetch()

On Fri, Mar 27, 2015 at 1:28 PM, Brett Zamir <brettz9@yahoo.com> wrote:
> Since fetch() is making life easier as is and in the spirit of promises, how
> about taking it a step further to simplify the frequent use case of needing
> to retrieve multiple resources and waiting for all to return?
>
> If the first argument to fetch() could be an array, then fetch() could be
> made to work like Promise.all() and return an array of the results to
> then().

It seems easy enough to just write that yourself, e.g.

  Promise.all(["image", "script"].map(url => fetch(url)))

works fine in Firefox Nightly.


-- 
https://annevankesteren.nl/

Received on Friday, 27 March 2015 12:39:28 UTC