Class ShareOperator
Implements the Share operator. Mirrors rxjs's share() with its default config.
public static class ShareOperator
- Inheritance
-
System.ObjectShareOperator
Methods
Share<T>(Observable<T>)
Multicasts source through an internal Subject<T>, subscribing to the
source only once (on the first subscriber) and unsubscribing when the last subscriber leaves. A later
subscription after the subscriber count drops back to zero reconnects to the source from scratch. See
ShareCore for the shared refCount logic. Equivalent to
source.Share(new ShareConfig<T>()) -- rxjs's own defaults
(resetOnError: true, resetOnComplete: true, resetOnRefCountZero: true, plain Subject<T>).
public static Observable<T> Share<T>(this Observable<T> source)
Parameters
sourceObservable<T>The source observable to multicast.
Returns
- Observable<T>
A multicast observable that shares one subscription to
sourceamong all its subscribers.
Type Parameters
TThe element type of the source observable.
Share<T>(Observable<T>, ShareConfig<T>)
Multicasts source the same way as Share<T>(Observable<T>), but with each
reset trigger and the connector factory configurable via config. See
ShareConfig<T> for what each option controls.
public static Observable<T> Share<T>(this Observable<T> source, ShareConfig<T> config)
Parameters
sourceObservable<T>The source observable to multicast.
configShareConfig<T>The reset/connector configuration to use.
Returns
- Observable<T>
A multicast observable that shares one subscription to
sourceamong all its subscribers.
Type Parameters
TThe element type of the source observable.