Contentful Personalization & Analytics
    Preparing search index...

    Minimal observable contract used by stateful Core signal streams.

    interface Observable<T> {
        current: T;
        subscribe: (next: (v: T) => void) => Subscription;
        subscribeOnce: (next: (v: NonNullable<T>) => void) => Subscription;
    }

    Type Parameters

    • T

      Value type emitted by the observable.

    Index

    Properties

    current: T

    Deep-cloned snapshot of the current signal value.

    A clone is returned to prevent accidental in-place mutations from leaking back into internal signal state.

    subscribe: (next: (v: T) => void) => Subscription

    Subscribe to all value updates (including the current value immediately).

    Type Declaration

    Values are deep-cloned before being passed to next.

    subscribeOnce: (next: (v: NonNullable<T>) => void) => Subscription

    Subscribe to the first non-nullish value, then auto-unsubscribe.

    Type Declaration

      • (next: (v: NonNullable<T>) => void): Subscription
      • Parameters

        • next: (v: NonNullable<T>) => void

          Callback invoked exactly once with the first non-nullish value.

        Returns Subscription

        A Subscription that can cancel before the first emission.

    Values are deep-cloned before being passed to next.