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

    Snapshot of the current signal value.

    Core state observables return deep-cloned snapshots by default to prevent accidental in-place mutations from leaking back into internal signal state. High-volume event-stream observables may return immutable event references to avoid cloning large Contentful entry graphs.

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

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

    Type Declaration

    Core state observable values are deep-cloned before being passed to next by default. High-volume event streams may pass immutable event references.

    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.

    Core state observable values are deep-cloned before being passed to next by default. High-volume event streams may pass immutable event references.