Skip to content

Commit e4f2d23

Browse files
natmegsbenlesh
authored andcommitted
docs(subject.md): clarify that refCount is an operator (#4774)
Clarify that refCount is an operator and not a method used directly on a ConnectableObservable. Closes #4664
1 parent 68d5128 commit e4f2d23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/subject.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ setTimeout(() => {
150150
}, 2000);
151151
```
152152

153-
If we wish to avoid explicit calls to `connect()`, we can use ConnectableObservable's `refCount()` method (reference counting), which returns an Observable that keeps track of how many subscribers it has. When the number of subscribers increases from `0` to `1`, it will call `connect()` for us, which starts the shared execution. Only when the number of subscribers decreases from `1` to `0` will it be fully unsubscribed, stopping further execution.
153+
If we wish to avoid explicit calls to `connect()`, we can use the `refCount()` operator (reference counting), which returns an Observable from a ConnectableObservable and keeps track of how many subscribers it has. When the number of subscribers increases from `0` to `1`, it will call `connect()` for us, which starts the shared execution. Only when the number of subscribers decreases from `1` to `0` will it be fully unsubscribed, stopping further execution.
154154

155155
<span class="informal">`refCount` makes the multicasted Observable automatically start executing when the first subscriber arrives, and stop executing when the last subscriber leaves.</span>
156156

@@ -202,7 +202,7 @@ setTimeout(() => {
202202
// observerB unsubscribed
203203
```
204204

205-
The `refCount()` method only exists on ConnectableObservable, and it returns an `Observable`, not another ConnectableObservable.
205+
The `refCount()` operator is only available to use on ConnectableObservable, and it returns an `Observable`, not another ConnectableObservable.
206206

207207
## BehaviorSubject
208208

0 commit comments

Comments
 (0)