marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.02k stars 796 forks source link

Ch11. "timeout arriving after the request finishes" clarification #510

Closed alexpi closed 4 years ago

alexpi commented 4 years ago

In 'Networks are hard', after the first code example, the text reads "The first time resolve or reject is called determines the outcome of the promise, and any further calls, such as the timeout arriving after the request finishes [...]".

The "timeout arriving after the request finishes" is ignored because it contains the if (done) return;, not because the promise is resolved or rejected, am I correct?

marijnh commented 4 years ago

Ah, good point, that paragraph was written before the code had the done variable added. Attached patch removes the reference to the timeout.