diff --git a/spec.bs b/spec.bs
index cbbcc3f..6063df1 100644
--- a/spec.bs
+++ b/spec.bs
@@ -273,8 +273,8 @@ The signal
getter steps are to
- To
close a subscription given a {{Subscriber}} |subscriber|, and
- an optional {{any}} |reason|, run these steps:
+ To
close a subscription given a {{Subscriber}} |subscriber|, and an optional {{any}}
+ |reason|, run these steps:
1. If |subscriber|'s [=Subscriber/active=] is false, then return.
@@ -318,8 +318,8 @@ observable.subscribe({}, {signal: outerController.signal});
1. [=Invoke=] |teardown|.
- If
an exception |E| was thrown, then [=report
- the exception=] |E|.
+ If
an exception |E| was thrown, then
+ [=report the exception=] |E|.
To
convert to an Observable an {{any}} |value|, run these steps:
- Note: We split this algorithm out from the Web IDL {{Observable/from()}} method, so that
- spec prose can
convert values to without
- going through the Web IDL bindings.
+ Note: We split this algorithm out from the Web IDL {{Observable/from()}} method, so that spec
+ prose can
convert values to without going
+ through the Web IDL bindings.
1. If [$Type$](|value|) is not [=Object=], [=exception/throw=] a {{TypeError}}.
@@ -666,9 +666,9 @@ An
internal observer is a [=struct=] with the following [=struct/item
{{ObserverUnion}}-or-[=internal observer=] |observer|, and a {{SubscribeOptions}} |options|, run
these steps:
- Note: We split this algorithm out from the Web IDL {{Observable/subscribe()}} method, so that
- spec prose can
subscribe to an
- {{Observable}} without going through the Web IDL bindings. See
subscribe to an {{Observable}}
+ without going through the Web IDL bindings. See
w3c/IntersectionObserver#464 for
similar context, where "internal" prose
must not go through Web IDL
bindings on objects whose properties could be mutated by JavaScript. See
@@ -729,8 +729,8 @@ An
internal observer is a [=struct=] with the following [=struct/item
1. [=Assert=]: |internal observer|'s [=internal observer/error steps=] is either the [=default
- error algorithm=], or an algorithm that [=invokes=] the provided {{SubscriptionObserver/error}}
- [=callback function=].
+ error algorithm=], or an algorithm that [=invokes=] the provided
+ {{SubscriptionObserver/error}} [=callback function=].
1. Let |subscriber| be a [=new=] {{Subscriber}}.
@@ -766,7 +766,8 @@ An
internal observer is a [=struct=] with the following [=struct/item
Operators
-For now, see [https://github.com/wicg/observable#operators](https://github.com/wicg/observable#operators).
+For now, see
+[https://github.com/wicg/observable#operators](https://github.com/wicg/observable#operators).
{{Observable/from()}}
@@ -796,18 +797,18 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
|sourceObservable|. We "unsubscribe" from **both** of them in the following situations:
1. |notifier| starts emitting values (either "next" or "error"). In this case, we
- unsubscribe from |notifier| since we got all we need from it, and no longer need it
- to keep producing values. We also unsubscribe from |sourceObservable|, because it
- no longer needs to produce values that get plumbed through this method's returned
+ unsubscribe from |notifier| since we got all we need from it, and no longer need it to
+ keep producing values. We also unsubscribe from |sourceObservable|, because it no
+ longer needs to produce values that get plumbed through this method's returned
|observable|, because we're manually ending the subscription to |observable|, since
|notifier| finally produced a value.
1. |sourceObservable| either {{Subscriber/error()}}s or {{Subscriber/complete()}}s
- itself. In this case, we unsubscribe from |notifier| since we no longer need to
- listen for values it emits in order to determine when |observable| can stop
- mirroring values from |sourceObservable| (since |sourceObservable| ran to
- completion by itself). Unsubscribing from |sourceObservable| isn't necessary, since
- its subscription has been exhausted by itself.
+ itself. In this case, we unsubscribe from |notifier| since we no longer need to listen
+ for values it emits in order to determine when |observable| can stop mirroring values
+ from |sourceObservable| (since |sourceObservable| ran to completion by itself).
+ Unsubscribing from |sourceObservable| isn't necessary, since its subscription has been
+ exhausted by itself.
1. Let |notifierObserver| be a new [=internal observer=], initialized as follows:
@@ -888,9 +889,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
:: 1. [=Invoke=] |mapper| with the passed in
The switchmap process next value steps, given an {{any}} |value|, a {{Subscriber}}
|subscriber|, a {{Mapper}} |mapper|, and references to all of the following: an
- {{AbortController}} |activeInnerAbortController|, a [=boolean=]
- |outerSubscriptionHasCompleted|, and an {{unsigned long long}} |idx| are to run these steps:
+ {{AbortController}} |activeInnerAbortController|, a [=boolean=] |outerSubscriptionHasCompleted|,
+ and an {{unsigned long long}} |idx| are to run these steps:
1. Let |mappedResult| be the result of [=invoking=] |mapper| with |value| and |idx|.
@@ -1297,8 +1298,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |innerOptions| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
result of [=creating a dependent abort signal=] from the list
«|activeInnerAbortController|'s [=AbortController/signal=], |subscriber|'s
- [=Subscriber/subscription controller=]'s [=AbortController/signal=]», using
- {{AbortSignal}}, and the [=current realm=].
+ [=Subscriber/subscription controller=]'s [=AbortController/signal=]», using {{AbortSignal}},
+ and the [=current realm=].
1. Subscribe to |innerObservable| given
|innerObserver| and |innerOptions|.
@@ -1370,7 +1371,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
:: 1. If |next callback| is not null, then [=invoke=] |next callback| with the passed in
|value|.
- If an exception |E| was thrown, then:
+ If an exception |E| was thrown,
+ then:
1. [=AbortSignal/Remove=] |abort callback| from |subscriber|'s
[=Subscriber/subscription controller=]'s [=AbortController/signal=].
@@ -1378,8 +1380,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
Note: This step is important, because the |abort callback| is only meant to be
called for *consumer-initiated* unsubscriptions. When the producer terminates
the subscription (via |subscriber|'s {{Subscriber/error()}} or
- {{Subscriber/complete()}} methods) like below, we have to ensure that
- |abort callback| is not run.
+ {{Subscriber/complete()}} methods) like below, we have to ensure that |abort
+ callback| is not run.
Issue: This matches Chromium's implementation, but consider holding a reference
to the originally-passed-in {{SubscribeOptions}}'s {{SubscribeOptions/signal}}
@@ -1398,9 +1400,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. If |error callback| is not null, then [=invoke=] |error callback| given the passed
in |error|.
- If an exception |E| was thrown,
- then run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these
- steps.
+ If an exception |E| was thrown, then
+ run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
1. Run |subscriber|'s {{Subscriber/error()}} method, given the passed in |error|.
@@ -1410,9 +1411,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. If |complete callback| is not null, then [=invoke=] |complete callback|.
- If an exception |E| was thrown,
- then run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these
- steps.
+ If an exception |E| was thrown, then
+ run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
1. Run |subscriber|'s {{Subscriber/complete()}} method.
@@ -1456,9 +1456,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
If an exception |E| was thrown, then
run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
- Issue: We shouldn't invoke {{Observable/from()}} directly. Rather, we should
- call some internal algorithm that passes-back the exceptions for us to handle
- properly here, since we want to pipe them to |subscriber|.
+ Issue: We shouldn't invoke {{Observable/from()}} directly. Rather, we should call
+ some internal algorithm that passes-back the exceptions for us to handle properly
+ here, since we want to pipe them to |subscriber|.
1. Let |innerObserver| be a new [=internal observer=], initialized as follows:
@@ -1485,7 +1485,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
will keep emitting values, because all of this is happening inside of the [=internal
observer/error steps=] associated with |sourceObservable|. This means
|sourceObservable| has already completed its subscription and will no longer produce
- any values, and we are free to safely switch our source of values to |innerObservable|.
+ any values, and we are free to safely switch our source of values to
+ |innerObservable|.
: [=internal observer/complete steps=]
:: Run |subscriber|'s {{Subscriber/complete()}} method.
@@ -1564,9 +1565,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |visitor callback controller| be a [=new=] {{AbortController}}.
1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
- result of [=creating a dependent abort signal=] from the list
- «|visitor callback controller|'s [=AbortController/signal=], |options|'s
- {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}}, and the [=current realm=].
+ result of [=creating a dependent abort signal=] from the list «|visitor callback
+ controller|'s [=AbortController/signal=], |options|'s {{SubscribeOptions/signal}} if
+ non-null», using {{AbortSignal}}, and the [=current realm=].
Many trivial [=internal observers=] act as pass-throughs, and do not control the
@@ -1602,8 +1603,8 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
Note: The fact that rejection of |p| is tied to |internal options|'s
{{SubscribeOptions/signal}}, and not |options|'s {{SubscribeOptions/signal}} means, that
any [=microtasks=] [=queue a microtask|queued=] during the firing of |options|'s
- {{SubscribeOptions/signal}}'s {{AbortSignal/abort}} event will run before |p|'s
- rejection handler runs.
+ {{SubscribeOptions/signal}}'s {{AbortSignal/abort}} event will run before |p|'s rejection
+ handler runs.
1. Let |idx| be an {{unsigned long long}}, initially 0.
@@ -1611,13 +1612,13 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
: [=internal observer/next steps=]
::
- 1. [=Invoke=] |callback| with the passed in value, and |idx|.
+ 1. [=Invoke=] |callback| with the passed in value, and |idx|.
If an exception |E| was thrown, then
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |visitor callback
controller| with |E|.
- 1. Increment |idx|.
+ 1. Increment |idx|.
: [=internal observer/error steps=]
:: [=Reject=] |p| with the passed in error.
@@ -1643,9 +1644,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |controller| be a [=new=] {{AbortController}}.
1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
- result of [=creating a dependent abort signal=] from the list
- «|controller|'s [=AbortController/signal=], |options|'s
- {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}}, and the [=current realm=].
+ result of [=creating a dependent abort signal=] from the list «|controller|'s
+ [=AbortController/signal=], |options|'s {{SubscribeOptions/signal}} if non-null», using
+ {{AbortSignal}}, and the [=current realm=].
1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=], then:
@@ -1791,9 +1792,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |controller| be a [=new=] {{AbortController}}.
1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
- result of [=creating a dependent abort signal=] from the list
- «|controller|'s [=AbortController/signal=], |options|'s
- {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}}, and the [=current realm=].
+ result of [=creating a dependent abort signal=] from the list «|controller|'s
+ [=AbortController/signal=], |options|'s {{SubscribeOptions/signal}} if non-null», using
+ {{AbortSignal}}, and the [=current realm=].
1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=], then:
@@ -1844,9 +1845,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |controller| be a [=new=] {{AbortController}}.
1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
- result of [=creating a dependent abort signal=] from the list
- «|controller|'s [=AbortController/signal=], |options|'s
- {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}}, and the [=current realm=].
+ result of [=creating a dependent abort signal=] from the list «|controller|'s
+ [=AbortController/signal=], |options|'s {{SubscribeOptions/signal}} if non-null», using
+ {{AbortSignal}}, and the [=current realm=].
1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=], then:
@@ -1898,9 +1899,9 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
1. Let |controller| be a [=new=] {{AbortController}}.
1. Let |internal options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is the
- result of [=creating a dependent abort signal=] from the list
- «|controller|'s [=AbortController/signal=], |options|'s
- {{SubscribeOptions/signal}} if non-null», using {{AbortSignal}}, and the [=current realm=].
+ result of [=creating a dependent abort signal=] from the list «|controller|'s
+ [=AbortController/signal=], |options|'s {{SubscribeOptions/signal}} if non-null», using
+ {{AbortSignal}}, and the [=current realm=].
1. If |internal options|'s {{SubscribeOptions/signal}} is [=AbortSignal/aborted=], then:
@@ -1991,7 +1992,8 @@ partial interface EventTarget {
1. If |subscriber|'s [=Subscriber/subscription controller=]'s [=AbortController/signal=]
is [=AbortSignal/aborted=], abort these steps.
- 1. [=Add an event listener=] with |event target| and an [=event listener=] defined as follows:
+ 1. [=Add an event listener=] with |event target| and an [=event listener=] defined as
+ follows:
: [=event listener/type=]
:: |type|
@@ -2015,8 +2017,8 @@ partial interface EventTarget {
:: |subscriber|'s [=Subscriber/subscription controller=]'s [=AbortController/signal=]
Note: This ensures that the [=event listener=] is cleaned up when
- [=Subscriber/subscription controller=]'s [=AbortController/signal=] is [=AbortSignal/aborted=],
- regardless of an engine's ownership model.
+ [=Subscriber/subscription controller=]'s [=AbortController/signal=] is
+ [=AbortSignal/aborted=], regardless of an engine's ownership model.
1. Return |observable|.
@@ -2043,7 +2045,6 @@ you can consult the following resources:
Acknowledgements
-A special thanks to [Ben Lesh](https://benlesh.com/) for much of the design
-input for the {{Observable}} API, and his many years of work maintaining
-userland Observable code that made this contribution to the web platform
-possible.
+A special thanks to [Ben Lesh](https://benlesh.com/) for much of the design input for the
+{{Observable}} API, and his many years of work maintaining userland Observable code that made this
+contribution to the web platform possible.