AboutSupportDeveloper GuideVersion 45.148.100.77

A readonly implementation of the observable pattern. Frameworks and vanilla consumers use this to read state and subscribe to changes.

interface Readable<T> {
    get(): T;
    subscribe(listener: (() => void)): (() => void);
}

Type Parameters

  • T

Methods

Methods

  • Synchronously returns the current value.

    Returns T

  • Subscribes to changes.

    Parameters

    • listener: (() => void)

      A callback that is invoked when the value changes.

        • (): void
        • Returns void

    Returns (() => void)

    An unsubscribe function to clean up the listener.

      • (): void
      • Returns void