@umbraco-cms/backoffice

    Class UmbObjectState<T>

    UmbObjectState

    • A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations. Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.

    The UmbObjectState provides methods to append data when the data is an Object.

    Type Parameters

    • T

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    _subject: BehaviorSubject<T>

    Accessors

    • get value(): T

      Returns T

      Observable that

      • Holds the current data of this state.
      const myState = new UmbArrayState('Hello world');
      console.log("Value is: ", myState.value);

    Methods

    • Function

      asObservable

      Returns Observable<T>

      Observable that the State casts to.

      • Creates a new Observable with this State as the source. Observe this to subscribe to its value and future changes.
      const myState = new UmbArrayState('Hello world');

      this.observe(myState, (latestStateValue) => console.log("Value is: ", latestStateValue));
    • Function

      getValue

      Returns T

      The current data of this state.

      • Provides the current data of this state.
      const myState = new UmbArrayState('Hello world');
      console.log("Value is: ", myState.value);
    • Function

      update

      Parameters

      • partialData: Partial<T>

        A object containing some of the data to update in this Subject.

      Returns UmbObjectState<T>

      Reference to it self.

      • Append some new data to this Object.
      const data = {key: 'myKey', value: 'myInitialValue'};
      const myState = new UmbObjectState(data);
      myState.update({value: 'myNewValue'});
    MMNEPVFCICPMFPCPTTAAATR