BACK
Referenceconnect
Reference · 51

connect

Creates a shared subscription inside a selector, without a manual Subject.

Signature

connect>(selector: (shared: Observable) => O): OperatorFunction>

What it does

Hands the selector a shared, multicast stream of source. Inside the selector you can subscribe to shared several times without creating multiple subscriptions to the original source.

When to use

When you need to temporarily share one expensive source within a single pipe composition: several computations from one HTTP/interval/DOM source.

See also

share, multicast

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