Skip to content

Commit c6c5ba2

Browse files
committed
Rename observer to monitor, move to FetchInit rather than RequestInit.
1 parent 1272a23 commit c6c5ba2

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

fetch.bs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7559,14 +7559,6 @@ dictionary RequestInit {
75597559
RequestDuplex duplex;
75607560
RequestPriority priority;
75617561
any window; // can only be set to null
7562-
FetchObserverCallback observer;
7563-
};
7564-
7565-
callback FetchObserverCallback = undefined (FetchObserver requestObserver, FetchObserver responseObserver);
7566-
7567-
[Exposed=(Window,Worker)]
7568-
interface FetchObserver : EventTarget {
7569-
attribute EventHandler onprogress;
75707562
};
75717563

75727564
enum RequestDestination { "", "audio", "audioworklet", "document", "embed", "font", "frame", "iframe", "image", "json", "manifest", "object", "paintworklet", "report", "script", "sharedworker", "style", "track", "video", "worker", "xslt" };
@@ -8521,7 +8513,18 @@ otherwise false.
85218513

85228514
<pre class=idl>
85238515
partial interface mixin WindowOrWorkerGlobalScope {
8524-
[NewObject] Promise&lt;Response> fetch(RequestInfo input, optional RequestInit init = {});
8516+
[NewObject] Promise&lt;Response> fetch(RequestInfo input, optional FetchInit init = {});
8517+
};
8518+
8519+
dictionary FetchInit : RequestInit {
8520+
FetchMonitorCallback monitor;
8521+
};
8522+
8523+
callback FetchMonitorCallback = undefined (FetchMonitor requestMonitor, FetchMonitor responseMonitor);
8524+
8525+
[Exposed=(Window,Worker)]
8526+
interface FetchMonitor : EventTarget {
8527+
attribute EventHandler onprogress;
85258528
};
85268529
</pre>
85278530

@@ -8595,28 +8598,28 @@ method steps are:
85958598

85968599
<li><p>Let <var>hasUploadListeners</var> be false.
85978600

8598-
<li><p>Let <var>requestObserver</var> be null.
8601+
<li><p>Let <var>requestMonitor</var> be null.
85998602

8600-
<li><p>Let <var>responseObserver</var> be null.
8603+
<li><p>Let <var>responseMonitor</var> be null.
86018604

86028605
<li>
8603-
<p>If <var>init</var>["{{RequestInit/observer}}"] <a for=map>exists</a>, then:
8606+
<p>If <var>init</var>["{{FetchInit/monitor}}"] <a for=map>exists</a>, then:
86048607

86058608
<ol>
8606-
<li><p>Let <var>observerCallback</var> be <var>init</var>["{{RequestInit/observer}}"].
8609+
<li><p>Let <var>monitorCallback</var> be <var>init</var>["{{FetchInit/monitor}}"].
86078610

8608-
<li><p>Set <var>requestObserver</var> to a {{FetchObserver}}.
8611+
<li><p>Set <var>requestMonitor</var> to a {{FetchMonitor}}.
86098612

8610-
<li><p>Set <var>responseObserver</var> to a {{FetchObserver}}.
8613+
<li><p>Set <var>responseMonitor</var> to a {{FetchMonitor}}.
86118614

8612-
<li><p>Let <var>args</var> be « <var>requestObserver</var>, <var>responseObserver</var> ».
8615+
<li><p>Let <var>args</var> be « <var>requestMonitor</var>, <var>responseMonitor</var> ».
86138616

8614-
<li><p>[=invoke|Invoke=] <var>observerCallback</var> with <var>args</var>
8617+
<li><p>[=invoke|Invoke=] <var>monitorCallback</var> with <var>args</var>
86158618
and <code>"rethrow"</code>. If this throws an exception, <a for=/>reject</a> <var>p</var> with it
86168619
and return <var>p</var>.
86178620

86188621
<li><p>If one or more <a event><code>progress</code></a> event listeners were added to
8619-
<var>requestObserver</var>, then set <var>hasUploadListeners</var> to true.
8622+
<var>requestMonitor</var>, then set <var>hasUploadListeners</var> to true.
86208623
</ol>
86218624

86228625
<li><p>Let <var>requestBodyTransmitted</var> be 0.
@@ -8636,7 +8639,7 @@ method steps are:
86368639
<li><p>If not roughly 50ms has passed since these steps were last invoked, then return.
86378640

86388641
<li><p>If <var>hasUploadListeners</var> is true, then <a>fire a progress event</a> named
8639-
<a event><code>progress</code></a> at <var>requestObserver</var> with <var>requestBodyTransmitted</var>
8642+
<a event><code>progress</code></a> at <var>requestMonitor</var> with <var>requestBodyTransmitted</var>
86408643
and <var>requestBodyLength</var>.
86418644
</ol>
86428645

@@ -8646,7 +8649,7 @@ method steps are:
86468649
<ol>
86478650
<li><p>If <var>hasUploadListeners</var> is false, then return.
86488651

8649-
<li><p><a>Fire a progress event</a> named <a event><code>progress</code></a> at <var>requestObserver</var>
8652+
<li><p><a>Fire a progress event</a> named <a event><code>progress</code></a> at <var>requestMonitor</var>
86508653
with <var>requestBodyTransmitted</var> and <var>requestBodyLength</var>.
86518654
</ol>
86528655

@@ -8688,7 +8691,7 @@ method steps are:
86888691
</ol>
86898692
</div>
86908693

8691-
TEMPORARY <dfn id=event-fetchobserver-progress event for=FetchObserver><code>progress</code></dfn>
8694+
TEMPORARY <dfn id=event-fetchmonitor-progress event for=FetchMonitor><code>progress</code></dfn>
86928695

86938696
<div algorithm>
86948697
<p>To <dfn lt="Abort the fetch() call" export id=abort-fetch>abort a <code>fetch()</code> call</dfn>

0 commit comments

Comments
 (0)