ReferencepublishBehavior
Reference · 86
publishBehavior
publishBehavior
DeprecatedMulticast via a BehaviorSubject.
Signature
publishBehavior(initialValue: T): UnaryFunction, ConnectableObservable>
What it does
Creates a connectable Observable over a BehaviorSubject with initialValue, so a subscriber can see the starting value.
When to use
Supporting legacy code. For new state, a BehaviorSubject directly, or share with a connector, is usually better.
Deprecated API
Marked deprecated in RxJS 7. In new code, use share({ connector: () => new BehaviorSubject(value) }).
See also
share, BehaviorSubject
script.ts
CONSOLE · Console output
Hit Run to see the result...