W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2014

Re: [whatwg] Questions about the Fetch API

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 8 Jul 2014 23:02:10 -0700
Message-ID: <CAAWBYDBQWp+G7_8edO5C6NAqEWZE=PoMkEdL1na7b3oC8n07Hg@mail.gmail.com>
To: Juan Ignacio Dopazo <jdopazo@yahoo-inc.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
On Tue, Jul 8, 2014 at 11:35 AM, Juan Ignacio Dopazo
<jdopazo@yahoo-inc.com> wrote:
> - And more importantly, why does fetch() return a Promise<Response> instead of a Response?

Because you aren't allowed to do network fetches sync.  (And if you
have an async action, returning a Promise for its result is the
idiomatic way to do it, rather than, say, making the object itself
asynchronous in some way.)

~TJ
Received on Wednesday, 9 July 2014 06:02:55 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:21 UTC