Interface Subscribable<T>

Interface for subscribable objects.

interface Subscribable<T = unknown> {
    subscribe(observer: Observer<T>): Unsubscribable;
    subscribe(
        next: (value: T) => void,
        error?: (error: Error) => void,
        complete?: () => void,
    ): Unsubscribable;
}

Type Parameters

  • T = unknown

Hierarchy (View Summary)

Methods

Methods

  • Subscribes the given observer to this object.

    Parameters

    • observer: Observer<T>

      The observer to subscribe.

    Returns Unsubscribable

    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

    • next: (value: T) => void

      Receives the next value in the sequence.

    • Optionalerror: (error: Error) => void

      Receives the sequence error.

    • Optionalcomplete: () => void

      Receives a completion notification.

    Returns Unsubscribable

    Object which can be used to unsubscribe the observer.