From 58346a1eca7d1c00dafc6618546f418cef1c0e2d Mon Sep 17 00:00:00 2001 From: Thomas Shafer Date: Fri, 23 Jun 2017 15:00:37 -0700 Subject: [PATCH] chore(documentation): Update share documentation Improve documenation on how .share() is different from .publish().refCount(). --- src/operator/share.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/operator/share.ts b/src/operator/share.ts index 973a672963..5c365aff61 100644 --- a/src/operator/share.ts +++ b/src/operator/share.ts @@ -10,7 +10,11 @@ function shareSubjectFactory() { * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`. - * This is an alias for .publish().refCount(). + * + * This behaves similarly to .publish().refCount(), with a behavior difference when the source observable emits complete. + * .publish().refCount() will not resubscribe to the original source, however .share() will resubscribe to the original source. + * Observable.of("test").publish().refCount() will not re-emit "test" on new subscriptions, Observable.of("test").share() will + * re-emit "test" to new subscriptions. * * *