multicast

function deprecated

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>

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

Parameters

subjectOrSubjectFactory

Type: Subject | (() => Subject).

selector

Optional. Default is undefined.

Type: (source: Observable) => Observable.

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.

Deprecation Notes

Will be removed in v8. To create a connectable observable, use connectable. If you're using refCount after multicast, use the share operator instead. multicast(subject), refCount() is equivalent to share({ connector: () => subject, resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

subject

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.

Deprecation Notes

Will be removed in v8. Use the connect operator instead. multicast(subject, selector) is equivalent to connect(selector, { connector: () => subject }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

subject

The subject used to multicast.

selector

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.

Deprecation Notes

Will be removed in v8. To create a connectable observable, use connectable. If you're using refCount after multicast, use the share operator instead. multicast(() => new BehaviorSubject('test')), refCount() is equivalent to share({ connector: () => new BehaviorSubject('test') }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

subjectFactory

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.

Deprecation Notes

Will be removed in v8. Use the connect operator instead. multicast(subjectFactory, selector) is equivalent to connect(selector, { connector: subjectFactory }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

subjectFactory

A factory that creates the subject used to multicast.

selector

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–2021 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/operators/multicast