rxjs / latest / api / index / interface / connectable.html

Connectable

interface stable

An observable with a connect method that is used to create a subscription to an underlying source, connecting it with all consumers via a multicast.

interface Connectable<T> extends Observable<T> {
  connect(): Subscription

  // inherited from index/Observable
  static create: (...args: any[]) => any
  constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic)
  source: Observable<any> | undefined
  operator: Operator<any, T> | undefined
  lift<R>(operator?: Operator<T, R>): Observable<R>
  subscribe(observerOrNext?: Partial<Observer<T>> | ((value: T) => void), error?: (error: any) => void, complete?: () => void): Subscription
  forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void>
  pipe(...operations: OperatorFunction<any, any>[]): Observable<any>
  toPromise(promiseCtor?: PromiseConstructorLike): Promise<T | undefined>
}

Methods

connect(): Subscription

(Idempotent) Calling this method will connect the underlying source observable to all subscribed consumers through an underlying Subject.

Parameters

There are no parameters.

Returns

Subscription: A subscription, that when unsubscribed, will "disconnect" the source from the connector subject, severing notifications to all consumers.

© 2015–2022 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/index/interface/Connectable