News for hackers. Stuff that matters.
Re:JavaScript async/await implemented in V8 by smilekzs on Monday May 16, 2016 @09:32PM (#11710811)
What you asked for is whether `await` is idempotent. No it isn't. The "argument" to `await` is a Promise, and the "return value" of it is the resolved value of the Promise (i.e. `Promise#then`).

EDIT: I missed the `.json()` part, but I suppose it doesn't return a Promise, no?

Re:JavaScript async/await implemented in V8 by tanto on Monday May 16, 2016 @09:38PM (#11710838)
actually .json() returns a Promise. The first fetch only returns HTTP status code and some other details. The content itself is streamed. You can also access the stream if you want too. In general you would rather just call .json() and get the parsed data.

The fetch function can for example also be used to get images. There you would use .blob() and assign that to an image.src with URL.createObjectURL(blob);

See here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/U...

Re:JavaScript async/await implemented in V8 by startling on Tuesday May 17, 2016 @01:40PM (#11715614)
This is totally not what I'm asking, thanks.