Extends UFKeyedStorage using localStorage to store values.

Hierarchy

  • UFKeyedStorage
    • UFLocalStorage

Constructors

Methods

  • Retrieves a boolean from storage. The default implementation gets the value as string and checks if it equals '1'

    Parameters

    • aKey: string

      Key to get value for

    • aDefault: boolean

      Default value to use

    Returns boolean

    stored value is '1' or aDefault if there is no item

  • Retrieves a integer from storage. The default implementation gets the value as string and uses parseInt to convert it back to an integer.

    Parameters

    • aKey: string

      Key to get integer for

    • aDefault: number

      Default value to use

    Returns number

    parsed integer or aDefault if there is no item or parsing resulted in a NaN value.

  • Retrieves a number from storage. The default implementation gets the value as string and uses parseFloat to convert it back to a number.

    Parameters

    • aKey: string

      Key to get value for

    • aDefault: number

      Default value to use

    Returns number

    parsed number or aDefault if there is no item or parsing resulted in a NaN value.

  • Retrieves an object from storage. The default implementation gets a string using getString and uses JSON.parse to convert a string back to an object.

    Type Parameters

    • T

    Parameters

    • aKey: string

      Key to retrieve object for

    • aDefault: T

      Default value to use

    Returns T

    parsed object or aDefault if there is no item or an exception occurred while parsing the string.

  • Parameters

    • aKey: string
    • aDefault: string

    Returns string

  • Stores a boolean in the storage. The default implementation stores either '1' or '0'.

    Parameters

    • aKey: string

      Key to store boolean for

    • aValue: boolean

      Boolean to store

    Returns void

  • Stores an integer in the storage. The default implementation converts the value to a string and stores it as a string.

    Parameters

    • aKey: string

      Key to store integer for

    • aValue: number

      Integer to store

    Returns void

  • Stores a number in the storage. The default implementation converts the value to a string and stores it as a string.

    Parameters

    • aKey: string

      Key to store number for

    • aValue: number

      number to store

    Returns void

  • Stores an object in the storage. The default implementation uses JSON.stringify and calls setString to store the object as string.

    Type Parameters

    • T

    Parameters

    • aKey: string

      Key to store object for

    • aValue: T

      Object to store

    Returns void

  • Parameters

    • aKey: string
    • aValue: string

    Returns void