API

Class DataStorage

Class for storing data to local storage if available or in-memory storage otherwise

Index
  • Reads a boolean from the data storage

    Parameters

    • key: string

      The key to read

    • defaultValue: boolean

      The value if the key doesn't exist

    Returns boolean

    The boolean value

  • Reads a JSON value from the data storage

    Type Parameters

    • T

    Parameters

    • key: string

      The key to read

    • defaultValue: T

      The value if the key doesn't exist

    Returns T

    The JSON value

  • Reads a number from the data storage

    Parameters

    • key: string

      The key to read

    • defaultValue: number

      The value if the key doesn't exist

    Returns number

    The number value

  • Reads a string from the data storage

    Parameters

    • key: string

      The key to read

    • defaultValue: string

      The value if the key doesn't exist

    Returns string

    The string value

  • Writes a boolean to the data storage

    Parameters

    • key: string

      The key to write

    • value: boolean

      The value to write

    Returns void

  • Writes a JSON value to the data storage

    Type Parameters

    • T

    Parameters

    • key: string

      The key to write

    • value: T

      The JSON value to write

    Returns void

  • Writes a number to the data storage

    Parameters

    • key: string

      The key to write

    • value: number

      The value to write

    Returns void

  • Writes a string to the data storage

    Parameters

    • key: string

      The key to write

    • value: string

      The value to write

    Returns void