publishBehavior
deprecatedCreates a ConnectableObservable that utilizes a BehaviorSubject.
Will be removed in v8. To create a connectable observable that uses a
BehaviorSubject under the hood, use connectable.
source.pipe(publishBehavior(initValue))
is equivalent to
connectable(source, { connector: () => new BehaviorSubject(initValue), resetOnDisconnect: false })
.
If you're using refCount after publishBehavior
, use the share operator instead.
source.pipe(publishBehavior(initValue), refCount())
is equivalent to
source.pipe(share({ connector: () => new BehaviorSubject(initValue), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))
.
Details: https://rxjs.dev/deprecations/multicasting
§Parameters
The initial value passed to the BehaviorSubject.
§Return Type
A function that returns a ConnectableObservable