Skip to content

Commit a819eeb

Browse files
committed
Subscriber does not need to reference Observable; Observable weakly refs Subscriber
1 parent a46bb3e commit a819eeb

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

spec.bs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ Each {{Subscriber}} has a <dfn for=Subscriber>subscription controller</dfn>, whi
188188

189189
Each {{Subscriber}} has a <dfn for=Subscriber>active</dfn> boolean, initially true.
190190

191-
Each {{Subscriber}} has an <dfn for=Subscriber>owning Observable</dfn>, an {{Observable}}, which is
192-
initialized during construction.
193-
194191
Note: This is a bookkeeping variable to ensure that a {{Subscriber}} never calls any of the
195192
callbacks it owns after it has been [=close a subscription|closed=].
196193

@@ -311,8 +308,6 @@ observable.subscribe({}, {signal: outerController.signal});
311308

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

314-
1. Set [=this=]'s [=Subscriber/owning Observable=]'s [=Observable/active subscriber=] to null.
315-
316311
1. [=AbortSignal/Signal abort=] |subscriber|'s [=Subscriber/subscription controller=] with
317312
|reason|, if it is given.
318313

@@ -416,7 +411,7 @@ interface Observable {
416411
Each {{Observable}} has a <dfn for=Observable>subscribe callback</dfn>, which is a
417412
{{SubscribeCallback}} or a set of steps that take in a {{Subscriber}}.
418413

419-
Each {{Observable}} has a <dfn for=Observable>active subscriber</dfn>, which is a
414+
Each {{Observable}} has a <dfn for=Observable>weak subscriber</dfn>, which is a weak reference to a
420415
{{Subscriber}}-or-null, initially null.
421416

422417
Note: The "union" of these types is to support both {{Observable}}s created by JavaScript (that are
@@ -744,10 +739,10 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
744739
error algorithm=], or an algorithm that [=invokes=] the provided
745740
{{SubscriptionObserver/error}} [=callback function=].
746741

747-
1. If [=this=]'s [=Observable/active subscriber=] is not null and [=this=]'s [=Observable/active
742+
1. If [=this=]'s [=Observable/weak subscriber=] is not null and [=this=]'s [=Observable/weak
748743
subscriber=]'s [=Subscriber/active=] is true:
749744

750-
1. Let |subscriber| be [=this=]'s [=Observable/active subscriber=].
745+
1. Let |subscriber| be [=this=]'s [=Observable/weak subscriber=].
751746

752747
1. [=set/Append=] |internal observer| to |subscriber|'s [=Subscriber/internal observers=].
753748

@@ -771,12 +766,11 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
771766

772767
1. Return.
773768

774-
1. Let |subscriber| be a [=new=] {{Subscriber}}, initialized with [=Subscriber/owning
775-
Observable=] as [=this=].
769+
1. Let |subscriber| be a [=new=] {{Subscriber}}.
776770

777771
1. [=set/Append=] |internal observer| to |subscriber|'s [=Subscriber/internal observers=].
778772

779-
1. Set [=this=]'s [=Observable/active subscriber=] to |subscriber|.
773+
1. Set [=this=]'s [=Observable/weak subscriber=] to |subscriber|.
780774

781775
1. If |options|'s {{SubscribeOptions/signal}} [=map/exists=], then:
782776

0 commit comments

Comments
 (0)