publishReplay

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

publishReplay<T, R>(bufferSize?: number, windowTime?: number, selectorOrScheduler?: TimestampProvider | OperatorFunction<T, R>, timestampProvider?: TimestampProvider)

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

bufferSize

Optional. Default is undefined.

Type: number.

windowTime

Optional. Default is undefined.

Type: number.

selectorOrScheduler

Optional. Default is undefined.

Type: TimestampProvider | OperatorFunction.

timestampProvider

Optional. Default is undefined.

Type: TimestampProvider.

Overloads

publishReplay(bufferSize?: number, windowTime?: number, timestampProvider?: TimestampProvider): MonoTypeOperatorFunction<T>

Creates a ConnectableObservable that uses a ReplaySubject internally.

Deprecation Notes

Will be removed in v8. To create a connectable observable that uses a ReplaySubject under the hood, use connectable. source.pipe(publishReplay(size, time, scheduler)) is equivalent to connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false }). If you're using refCount after publishReplay, use the share operator instead. publishReplay(size, time, scheduler), refCount() is equivalent to share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

bufferSize

Optional. Default is undefined.

The buffer size for the underlying ReplaySubject.

windowTime

Optional. Default is undefined.

The window time for the underlying ReplaySubject.

timestampProvider

Optional. Default is undefined.

The timestamp provider for the underlying ReplaySubject.

Returns

MonoTypeOperatorFunction<T>

publishReplay(bufferSize: number, windowTime: number, selector: (shared: Observable<T>) => O, timestampProvider?: TimestampProvider): OperatorFunction<T, ObservedValueOf<O>>

Creates an observable, that when subscribed to, will create a ReplaySubject, and pass an observable from it (using asObservable) to the selector function, which then returns an observable that is subscribed to before "connecting" the source to the internal ReplaySubject.

Deprecation Notes

Will be removed in v8. Use the connect operator instead. source.pipe(publishReplay(size, window, selector, scheduler)) is equivalent to source.pipe(connect(selector, { connector: () => new ReplaySubject(size, window, scheduler) })). Details: https://rxjs.dev/deprecations/multicasting

Parameters

bufferSize

The buffer size for the underlying ReplaySubject.

windowTime

The window time for the underlying ReplaySubject.

selector

A function used to setup the multicast.

timestampProvider

Optional. Default is undefined.

The timestamp provider for the underlying ReplaySubject.

Returns

OperatorFunction<T, ObservedValueOf<O>>

Since this is deprecated, for additional details see the documentation for connect.

publishReplay(bufferSize: number, windowTime: number, selector: undefined, timestampProvider: TimestampProvider): OperatorFunction<T, ObservedValueOf<O>>

Creates a ConnectableObservable that uses a ReplaySubject internally.

Deprecation Notes

Will be removed in v8. To create a connectable observable that uses a ReplaySubject under the hood, use connectable. source.pipe(publishReplay(size, time, scheduler)) is equivalent to connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false }). If you're using refCount after publishReplay, use the share operator instead. publishReplay(size, time, scheduler), refCount() is equivalent to share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }). Details: https://rxjs.dev/deprecations/multicasting

Parameters

bufferSize

The buffer size for the underlying ReplaySubject.

windowTime

The window time for the underlying ReplaySubject.

selector

Passing undefined here determines that this operator will return a ConnectableObservable.

timestampProvider

The timestamp provider for the underlying ReplaySubject.

Returns

OperatorFunction<T, ObservedValueOf<O>>

© 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/publishReplay