Class LocalStorageMap<K, V>

A map that stores data in local storage with prefixed keys. Note that this does not preserve insertion order.

Type Parameters

  • K extends string

  • V extends string

Hierarchy

  • SyncMapBatchAdapter<K, V>
    • LocalStorageMap

Implements

Constructors

  • Type Parameters

    • K extends string

    • V extends string

    Parameters

    • prefix: string = ''

      Unique prefix for keys.

    • storage: Storage = window.localStorage

      The underlying storage.

    Returns LocalStorageMap<K, V>

Properties

prefix: string = ''

Unique prefix for keys.

storage: Storage = window.localStorage

The underlying storage.

Accessors

  • get size(): number
  • Returns the size of this map. Note that this is a heavy operation that loops through the storage to count the number of keys with matching prefix.

    Returns number

Methods

  • Parameters

    • callbackfn: ((value, key, map) => void)
        • (value, key, map): void
        • Parameters

          Returns void

    • Optional thisArg: unknown

    Returns void

Generated using TypeDoc