Class LocalStorageAbstract

Constructors

Accessors

  • get isBrowserLocalStorage(): boolean
  • Returns if the module is using a browser's localStorage

    Returns boolean

  • get path(): undefined | string
  • Returns the current local storage path if not browser

    Returns undefined | string

  • set path(value): void
  • Sets the local storage path if not browser

    Parameters

    • value: undefined | string

    Returns void

Methods

  • Clears the local storage

    Returns void

  • Sets the domain scope of the local storage on disk

    This prevents other applications using this library from stomping on the storage of others

    Note: For scope to apply, must be called before all other calls

    Parameters

    • scope: string

    Returns void

  • Retrieves the value for the specified key if it exists in the local storage

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns undefined | ValueType

  • Returns if the local storage has the key available

    Type Parameters

    • KeyType = any

    Parameters

    Returns boolean

    Deprecated

  • Retrieves the underlying key ID for the specified key

    Type Parameters

    • KeyType = any

    Parameters

    Returns string

  • Returns if the local storage has the key available

    Type Parameters

    • KeyType = any

    Parameters

    Returns boolean

  • Removes a listener previously attached with LocalStorage.on(key, fn).

    value: the current value for key in local storage, parsed from the persisted JSON old: the old value for key in local storage, parsed from the persisted JSON url: the url for the tab where the modification came from

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns void

  • Listen for changes persisted against key on other tabs. Triggers StorageCallback when a change occurs, passing the following arguments.

    value: the current value for key in local storage, parsed from the persisted JSON old: the old value for key in local storage, parsed from the persisted JSON url: the url for the tab where the modification came from

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns void

  • Listen ONCE for changes persisted against key on other tabs Triggers StorageCallback when a change occurs, passing the following arguments.

    value: the current value for key in local storage, parsed from the persisted JSON old: the old value for key in local storage, parsed from the persisted JSON url: the url for the tab where the modification came from

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns void

  • Removes the key from local storage

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns void

  • Sets the value for the key in local storage

    Type Parameters

    • ValueType = any
    • KeyType = any

    Parameters

    Returns void