Skip to content

Commit

Permalink
pass abortsignal reason to close a subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Jul 27, 2024
1 parent 530d498 commit aee83d0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ urlPrefix: https://dom.spec.whatwg.org; spec: DOM
for: AbortSignal
text: dependent signals; url: abortsignal-dependent-signals
text: signal abort; url:abortsignal-signal-abort
text: reason; url:abortsignal-abort-reason
</pre>

<style>
Expand Down Expand Up @@ -262,7 +263,8 @@ The <dfn attribute for=Subscriber><code>signal</code></dfn> getter steps are to
</div>

<div algorithm>
To <dfn>close a subscription</dfn> given a {{Subscriber}} |subscriber|, run these steps:
To <dfn>close a subscription</dfn> given a {{Subscriber}} |subscriber|, and
an optional {{any}} |reason|, run these steps:

1. If |subscriber|'s [=Subscriber/active=] is false, then return.

Expand Down Expand Up @@ -292,9 +294,10 @@ observable.subscribe({}, {signal: outerController.signal});

1. Set |subscriber|'s [=Subscriber/active=] boolean to false.

1. [=AbortSignal/Signal abort=] |subscriber|'s [=Subscriber/subscription controller=].
1. [=AbortSignal/Signal abort=] |subscriber|'s [=Subscriber/subscription controller=]
with |reason|, if it is given.

Issue: Abort with an appropriate abort reason.
Issue: Abort with an appropriate abort reason if none given.

1. [=list/For each=] |teardown| of |subscriber|'s [=Subscriber/teardown callbacks=] sorted in
reverse insertion order:
Expand Down Expand Up @@ -532,7 +535,8 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
1. Otherwise, [=AbortSignal/add|add the following abort algorithm=] to |options|'s
{{SubscribeOptions/signal}}:

1. [=close a subscription|Close=] |subscriber|.
1. [=close a subscription|Close=] |subscriber| with |options|'s
{{SubscribeOptions/signal}} [=AbortSignal/reason=]{{reason}}.

1. If [=this=]'s [=Observable/subscribe callback=] is a {{SubscribeCallback}}, [=invoke=] it
with |subscriber|.
Expand Down

0 comments on commit aee83d0

Please sign in to comment.