Re: [whatwg/fetch] Return a "controller" instance from fetch (#1329)

@annevk commented on this pull request.

\o/ looks even better. I'll file a follow-up on where we should define fetch params and such.

This PR should also update the "Invoking fetch" section with a few words about the return value of fetch.

> @@ -255,6 +258,29 @@ given a <a for=/>fetch timing info</a> <var>timingInfo</var>, return a new
  <var>storedTimingInfo</var>'s <a for="fetch timing info">decoded body size</a>.
 </ol>
 
+<p>To <dfn for="fetch params">abort</dfn> a <a for=/>fetch params</a> <var>fetchParams</var>,
+set <var>fetchParams</var>'s <a for="fetch params">fetch state</a> to "<code>aborted</code>".
+
+<p>To <dfn for="fetch params">terminate</dfn> a <a for=/>fetch params</a> <var>fetchParams</var>,
+set <var>fetchParams</var>'s <a for="fetch params">fetch state</a> to "<code>terminated</code>".
+
+<p>A <a for=/>fetch params</a> <var>fetchParams</var> is <a for="fetch params">terminated</a> if

"terminated" here ends up linking to "terminate" above. That's a little confusing. Maybe something like

`<dfn for="fetch params">ended abruptly</dfn>`

to represent these states?

> + <p>If this instance of <a for=/>fetch</a> is
+ <dfn export for=fetch id=concept-fetch-terminate>terminated</dfn> given flag <var>aborted</var>,
+ which is unset unless otherwise specified, <a for="fetch controller">terminate</a>
+ <var>controller</var> if <var>aborted</var> is set, otherwise <a for="fetch controller">abort</a>
+ <var>controller</var>.
+
+ <p class="note">The above exported function is to be replaced by
+ <a for="fetch controller" lt=terminate>terminating</a> or
+ <a for="fetch controller" lt=abort>aborting</a> the <a for=/>fetch controller</a>
+ returned by this algorithm.

I think we should preserve the ID (perhaps move it to the new terminate algorithm on controller), but otherwise I'd remove this. I think it's only HTML that invokes this so if we keep the link working it should mostly be okay.

> +   <li><p>Let <var>state</var> be <var>fetchParams</var>'s
+   <a for="fetch params">fetch state</a>.
 
-   <li><p>If <var>aborted</var> is set, then set <var>response</var>'s
+   <li><p>If <var>state</var> is "<code>aborted</code>", then set <var>response</var>'s

I'd inline this to avoid the _state_ variable.

> +     <li><p>Let <var>state</var> be <var>fetchParams</var>'s
+     <a for="fetch params">fetch state</a>.
 
      <li>
-      <p>If <var>aborted</var> is set, then:
+      <p>If <var>state</var> is "<code>aborted</code>", then:

I'd inline the _state_ variable here too.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1329#pullrequestreview-786764778

Received on Friday, 22 October 2021 12:15:32 UTC