@kayahr/observable

    Interface ObservableLike<T>

    The base interface for observable objects.

    interface ObservableLike<T = unknown> {
        "[observable]"(): InteropSubscribable<T>;
        subscribe(observer: Observer<T>): Subscription;
        subscribe(
            next: (value: T) => void,
            error?: (error: Error) => void,
            complete?: () => void,
        ): Subscription;
    }

    Type Parameters

    • T = unknown

    Hierarchy (View Summary, Expand)

    Implemented by

    Index

    Methods

    • 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

      • 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 Subscription

      Object which can be used to unsubscribe the observer.

    MMNEPVFCICPMFPCPTTAAATR