@minecraft/server-ui
    Preparing search index...

    Class Observable<T>Beta

    A class that represents data that can be Observed. Extensively used for UI.

    Type Parameters

    Index

    Constructors

    Methods

    • Beta

      Returns T

      Gets the data from the Observable.

    • Beta

      Parameters

      • data: T

      Returns void

      Sets the data on this Observable and notifies the subscribers.

    • Beta

      Parameters

      • listener: (newValue: T) => void

      Returns (newValue: T) => void

      Subscribes a callback to any changes that occur to the Observable. The return value can be passed into the unsubscribe function to stop listening to changes.

    • Beta

      Parameters

      • listener: (newValue: T) => void

      Returns void

      Unsubscribe a callback from any changes that occur to the Observable. This takes the return value from the subscribe function.