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

@jakearchibald commented on this pull request.



> @@ -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 <dfn for="fetch params">canceled</dfn> if
+its <a for="fetch params">fetch state</a> is "<code>aborted</code>" or "<code>terminated</code>".
+
+<p>A <dfn export>fetch controller</dfn> is an object used to enable clients of an ongoing fetch
+to perform certain actions in the context of that fetch instance.

Rather than have a "controller" which proxies particular state and actions to the `fetch params`, would it make more sense to make the controller something which holds the state? Then, it can exist both in a fetch record and fetch params.

So, **fetch state** has **phase** which is "ongoing", "aborted"…

A **fetch state** can be **terminated**… etc etc

**Fetch params** has a **fetch state**.

A **fetch record** has a **fetch state**.

So a single **fetch state** can be in a **fetch params** but also a **fetch record**.

That means the fetch record only has access to the subset of state by design. There's no proxying needed. And nothing is implicitly private.

Does this make sense @annevk? 



-- 
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#discussion_r738696667

Received on Thursday, 28 October 2021 19:37:53 UTC