BACK
Referencepublish
Reference · 85

publish

publish

Deprecated
rxjs.dev

Shorthand for multicast(new Subject()).

Signature

publish(): UnaryFunction, ConnectableObservable>

What it does

Turns source into a connectable Observable via a Subject. To auto-connect, you'd usually add refCount.

When to use

Supporting legacy code. In modern RxJS, use share or connect.

Deprecated API

Marked deprecated in RxJS 7. In new code, use share or connect.

See also

share, connect, refCount

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...