diff --git a/spec.bs b/spec.bs index 38b265a..6db9875 100644 --- a/spec.bs +++ b/spec.bs @@ -743,7 +743,76 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
forEach(|callback|, |options|)
method steps are:
- 1. TODO: Spec this and use |callback| and |options|.
+ 1. Let |p| [=a new promise=].
+
+ 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=].
+
+ Many trivial [=internal observers=] act as pass-throughs, and do not control the + subscription to the {{Observable}} that they represent; that is, their [=internal + observer/error steps=] and [=internal observer/complete steps=] are called when the + subscription is terminated, and their [=internal observer/next steps=] simply pass some + version of the given value along the chain.
+ +For this operator, however, the below |observer|'s [=internal observer/next steps=] are
+ responsible for actually aborting the underlying subscription to [=this=], in the event
+ that |callback| throws an exception. In that case, the {{SubscribeOptions}}'s
+ {{SubscribeOptions/signal}} we pass through to "Subscribe to an Observable
", needs to be a [=creating a
+ dependent abort signal|dependent signal=] derived from |options|'s
+ {{SubscribeOptions/signal}}, **and** the {{AbortSignal}} of an {{AbortController}} that the
+ [=internal observer/next steps=] below has access to, and can [=AbortController/signal
+ abort=] when needed.
+