Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StoreElementRoot<T>

A special type of StoreElement that represents the top level object from the extension storage.

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

Protected _container

_container: Indexable<StoreElement<T[keyof T]> | T[keyof T]>

Private _key

_key: string

Protected _root

_root: StoreElementRoot<any>

Private _store

_store: Store

onUpdate$

onUpdate$: Subject<this>

Observable which pushes a new value when anything changes.

see

StoreElement.value$ which does the same but always pushes the current value first.

value$

value$: BehaviorSubject<this>

Like StoreElement.onUpdate$ but a BeahviourSubject. As such it always pushes the current value when you subscribe to it.

Accessors

isArray

  • get isArray(): boolean
  • Find out whether this store element represents an array instead of an object.

    Returns boolean

rawValue

  • get rawValue(): T
  • Return the "raw" value such as the one that was used to create this element. This recursively traverses the element tree and converts the nested store elements to their raw value.

    This returns a copy of the value, not the original one.

    Returns T

Methods

deleteProperty

  • deleteProperty(key: string | number): void

equals

  • equals(other: T): boolean
  • Check whether the StoreElement is equal to a raw value. This is not a comparator between StoreElement. It is used by StoreElement.update to check whether something has changed.

    example
    
    // storeEl is a StoreElement!
    
    // this is a tautology!
    storeEl.equals(storeEl.rawValue);

    Parameters

    • other: T

    Returns boolean

get

  • get(key: string | number): any

getOrSetDefault

  • getOrSetDefault<V>(key: string | number, defaultValue: V): V | StoreElementProxy<V>

getOwnPropertyDescriptor

  • getOwnPropertyDescriptor(p: string | number): PropertyDescriptor | undefined

has

  • has(key: any): boolean

ownKeys

  • ownKeys(): string[]

save

  • save(): Promise<void>

set

  • set(key: string | number, value: any): void

setDefaults

  • setDefaults(defaults: T): void

Protected setValueSelf

  • setValueSelf(value: T): void

triggerSave

  • triggerSave(): void

update

  • update(newValue: T): void
  • Receive a new value and apply it to this element. This is not a method you should use! It is exposed for Store to apply changes to this element.

    see

    StoreElement.setDefaults for a way to set defaults.

    Parameters

    • newValue: T

    Returns void

Static create

Static createRoot

Generated using TypeDoc