Class SharedObservable<T>

A shared observable is a multicast observable maintaining an internal list of subscribers. The subscriber function is called when the first subscriber subscribes to the observable. The teardown function is called when the last subscriber is unsubscribed.

Type Parameters

  • T

Hierarchy (View Summary)

Constructors

Methods

  • Returns itself. This is used as a fallback for environments which don't support Symbol.observable.

    Returns this

  • Subscribes the given observer to this object.

    Parameters

    • observer: Observer<T>

      The observer to subscribe.

    Returns Subscription

    Object which can be used to unsubscribe the observer.

  • Constructs a new observer using the given callback functions and subscribes it to this object.

    Parameters

    • onNext: (value: T) => void

      Receives the next value in the sequence.

    • OptionalonError: (error: Error) => void

      Receives the sequence error.

    • OptionalonComplete: () => void

      Receives a completion notification.

    Returns Subscription

    Object which can be used to unsubscribe the observer.

  • Parameters

    • next: undefined | null
    • error: undefined | null
    • complete: () => void

    Returns Subscription

    Use an observer instead of a complete callback

  • Parameters

    • next: undefined | null
    • error: (error: any) => void
    • Optionalcomplete: () => void

    Returns Subscription

    Use an observer instead of an error callback

  • Parameters

    • next: (value: T) => void
    • error: undefined | null
    • complete: () => void

    Returns Subscription

    Use an observer instead of a complete callback

  • Parameters

    Returns Subscription