rxjs / 7.5.5 / api / index / function / multicast.html /

multicast

function deprecated operator

Deprecation Notes

Will be removed in v8. Use the connectable observable, the connect operator or the share operator instead. See the overloads below for equivalent replacement examples of this operator's behaviors. Details: https://rxjs.dev/deprecations/multicasting

multicast<T, R>(subjectOrSubjectFactory: Subject<T> | (() => Subject<T>), selector?: (source: Observable<T>) => Observable<R>): OperatorFunction<T, R>

Parameters

subjectOrSubjectFactory Subject<T> | (() => Subject<T>)
selector (source: Observable<T>) => Observable<R>

Optional. Default is undefined.

Returns

OperatorFunction<T, R>

Overloads

multicast(subject: Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>

An operator that creates a ConnectableObservable, that when connected, with the connect method, will use the provided subject to multicast the values from the source to all consumers.

Parameters

subject Subject<T>

The subject to multicast through.

Returns

UnaryFunction<Observable<T>, ConnectableObservable<T>>: A function that returns a ConnectableObservable

multicast(subject: Subject<T>, selector: (shared: Observable<T>) => O): OperatorFunction<T, ObservedValueOf<O>>

Because this is deprecated in favor of the connect operator, and was otherwise poorly documented, rather than duplicate the effort of documenting the same behavior, please see documentation for the connect operator.

Parameters

subject Subject<T>

The subject used to multicast.

selector (shared: Observable<T>) => O

A setup function to setup the multicast

Returns

OperatorFunction<T, ObservedValueOf<O>>: A function that returns an observable that mirrors the observable returned by the selector.

multicast(subjectFactory: () => Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>

An operator that creates a ConnectableObservable, that when connected, with the connect method, will use the provided subject to multicast the values from the source to all consumers.

Parameters

subjectFactory () => Subject<T>

A factory that will be called to create the subject. Passing a function here will cause the underlying subject to be "reset" on error, completion, or refCounted unsubscription of the source.

Returns

UnaryFunction<Observable<T>, ConnectableObservable<T>>: A function that returns a ConnectableObservable

multicast(subjectFactory: () => Subject<T>, selector: (shared: Observable<T>) => O): OperatorFunction<T, ObservedValueOf<O>>

Because this is deprecated in favor of the connect operator, and was otherwise poorly documented, rather than duplicate the effort of documenting the same behavior, please see documentation for the connect operator.

Parameters

subjectFactory () => Subject<T>

A factory that creates the subject used to multicast.

selector (shared: Observable<T>) => O

A function to setup the multicast and select the output.

Returns

OperatorFunction<T, ObservedValueOf<O>>: A function that returns an observable that mirrors the observable returned by the selector.

© 2015–2022 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/index/function/multicast