@umbraco-cms/backoffice

    Class UmbStringState<T>

    UmbStringState

    • A state holding string data, this ensures the data is unique, not updating any Observes unless there is an actual change of the value, by using ===.

    Type Parameters

    • T

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    _subject: BehaviorSubject<string | 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<string | 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 string | 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

      setValue

      Parameters

      • data: string | T

        The next data for this state to hold.

      Returns void

      • Set the data of this state, if data is different than current this will trigger observations to update.
      const myState = new UmbArrayState('Good morning');
      // myState.value is equal 'Good morning'.
      myState.setValue('Goodnight')
      // myState.value is equal 'Goodnight'.
    MMNEPVFCICPMFPCPTTAAATR