Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "storage/localstorage-util"

Index

Variables

Const _

_: any = externalInterface.underscore

Const find

find: any = _.find

Const findIndex

findIndex: any = _.findIndex

Const globalLocalStorage

globalLocalStorage: Storage = window.localStorage

Const union

union: any = _.union

Functions

cleanEntity

  • cleanEntity(key: string, ty: ITypeDef): void
  • Cleans the value of an entity by its key.

    function

    cleanEntity

    Parameters

    • key: string

      The entity key.

    • ty: ITypeDef

      The type of the entity value.

    Returns void

cleanEntityGroup

  • cleanEntityGroup(prefix: string): Array<string>
  • Removes a group of entities by a given prefix.

    function

    cleanEntityGroup

    Parameters

    • prefix: string

      The prefix of the keys of the entities to be removed. We organize entities somewhat hirarchly.

    Returns Array<string>

findEntityById

  • findEntityById(key: string, id: any): IEntity
  • Finds one element of an entity of type array.

    function

    findEntityById

    Parameters

    • key: string

      The entity key.

    • id: any

      The identifier value. An Id field is assumed for each element.

    Returns IEntity

    The value of the found element.

getEntity

  • getEntity(key: string, ty: ITypeDef): any
  • Reads the value of an entity by its key.

    function

    getEntity

    Parameters

    • key: string

      The entity key.

    • ty: ITypeDef

      The type of the entity value.

    Returns any

    The entity value.

insertEntities

  • insertEntities(key: string, data: Array<IEntity>, upperBound: number): void
  • Inserts the given data into the value of an entity of type array. Note that the inserted data should be disjoint with the current data stored in this entity. Otherwise, the behavior may be undefined.

    function

    insertEntities

    Parameters

    • key: string

      The entity key.

    • data: Array<IEntity>

      The value to be inserted.

    • upperBound: number

      The max number of elements allows for this entity value.

    Returns void

insertOrUpdateEntity

  • insertOrUpdateEntity(key: string, entity: IEntity): void
  • Inserts or udpates an element of an entity of type array.

    function

    insertOrUpdateEntity

    Parameters

    • key: string

      The entity key.

    • entity: IEntity

      The new value of the entity.

    Returns void

removeEntityById

  • removeEntityById(key: string, id: any): void
  • Removes an element of an entity of type array.

    function

    removeEntityById

    Parameters

    • key: string

      The entity key.

    • id: any

      The identifier value for the element to be removed.

    Returns void

updateEntity

  • updateEntity(key: string, data: any, ty?: ITypeDef): void
  • Updates the value of an entity by its key.

    function

    updateEntity

    Parameters

    • key: string

      The entity key.

    • data: any

      The new value to be replaced with.

    • Default value ty: ITypeDef = null

      The type of the entity value.

    Returns void

Generated using TypeDoc