@@ -5,10 +5,15 @@ import { Subscription } from '../Subscription';
55import { MonoTypeOperatorFunction , SubjectLike , ObservableInput } from '../types' ;
66import { operate } from '../util/lift' ;
77
8+ /**
9+ * The {@link share} operator configuration object interface.
10+ */
811export interface ShareConfig < T > {
912 /**
1013 * The factory used to create the subject that will connect the source observable to
1114 * multicast consumers.
15+ *
16+ * If not provided, defaults to: `() => new Subject<T>()`.
1217 */
1318 connector ?: ( ) => SubjectLike < T > ;
1419 /**
@@ -20,6 +25,8 @@ export interface ShareConfig<T> {
2025 * {@link ReplaySubject} will also push its buffered values before pushing the error.
2126 * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
2227 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
28+ *
29+ * If not provided, defaults to: `true`.
2330 */
2431 resetOnError ?: boolean | ( ( error : any ) => ObservableInput < any > ) ;
2532 /**
@@ -30,6 +37,8 @@ export interface ShareConfig<T> {
3037 * or resubscriptions will resubscribe to that same subject.
3138 * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
3239 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
40+ *
41+ * If not provided, defaults to: `true`.
3342 */
3443 resetOnComplete ?: boolean | ( ( ) => ObservableInput < any > ) ;
3544 /**
@@ -41,6 +50,8 @@ export interface ShareConfig<T> {
4150 * will remain connected to the source, and new subscriptions to the result will be connected through that same subject.
4251 * It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
4352 * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
53+ *
54+ * If not provided, defaults to: `true`.
4455 */
4556 resetOnRefCountZero ?: boolean | ( ( ) => ObservableInput < any > ) ;
4657}
@@ -52,7 +63,8 @@ export function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;
5263/**
5364 * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
5465 * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
55- * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
66+ * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream
67+ * {@link guide/glossary-and-semantics#hot hot}.
5668 *
5769 * The subscription to the underlying source Observable can be reset (unsubscribe and resubscribe for new subscribers),
5870 * if the subscriber count to the shared observable drops to 0, or if the source Observable errors or completes. It is
@@ -135,7 +147,10 @@ export function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;
135147 * ```
136148 *
137149 * @see {@link shareReplay }
150+ * @see {@link ShareConfig }
138151 *
152+ * @param options A configuration object used to configure things like {@link ShareConfig#connector connector}
153+ * and various reset options.
139154 * @return A function that returns an Observable that mirrors the source.
140155 */
141156export function share < T > ( options : ShareConfig < T > = { } ) : MonoTypeOperatorFunction < T > {
0 commit comments