@amirsavand/ngx-common - v5.1.0
    Preparing search index...

    Class InlineStorage<T>

    When you want a variable to stay in local storage and load it with a single line of code.

    T is type of data to store.

    Type Parameters

    • T
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Type Parameters

      • T

      Parameters

      • key: string

        Unique key of this data.

      • defaultValue: T

        Value that is used if it's not stored before.

      Returns InlineStorage<T>

    Properties

    _signal: WritableSignal<T>

    Signal containing latest value.

    _value: T

    Data value that's stored.

    change: EventEmitter<T> = ...

    Emits when the stored data is changed.

    defaultValue: T

    Value that is used if it's not stored before.

    key: string

    Unique key of this data.

    lastValue: T

    Last value that was set, can be changed without effecting storage.

    For OnPush components, use signal instead.

    signal: Signal<T>

    Signal containing latest value (read-only).

    Accessors

    • get value(): T

      Returns T

      the current value of stored data.

    • set value(value: T): void

      Change the stored data and update the storage.

      Parameters

      • value: T

        New data value.

      Returns void

    Methods

    • Remove this object from storage completely and reset it to its initial value.

      Returns void