Type Parameters

Hierarchy

  • default

Implements

Constructors

  • Type Parameters

    Parameters

    Returns default<T>

Properties

#private: any
_containsReservedKey: any
_deserialize: any
_encryptData: any
_ensureDirectory: any
_get: any
_handleChange: any
_isVersionInRangeFormat: any
_migrate: any
_serialize: any
_set: any
_shouldPerformMigration: any
_validate: any
_watch: any
_write: any
events: EventEmitter
path: string

Accessors

  • get size(): number
  • Returns number

  • get store(): T
  • Returns T

  • set store(value): void
  • Parameters

    • value: T

    Returns void

Methods

  • Delete all items.

    This resets known items to their default values, if defined by the defaults or schema option.

    Returns void

  • Delete an item.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • key: Key

      The key of the item to delete.

    Returns void

  • Get an item.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • key: Key

      The key of the item to get.

    Returns T[Key]

  • Type Parameters

    • Key extends string | number | symbol

    Parameters

    Returns Required<T>[Key]

  • Type Parameters

    • Key extends string

    • Value = unknown

    Parameters

    • key: Exclude<Key, keyof T>
    • Optional defaultValue: Value

    Returns Value

  • Check if an item exists.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • key: string | Key

      The key of the item to check.

    Returns boolean

  • Watches the whole config object, calling callback on any changes.

    Parameters

    • callback: OnDidAnyChangeCallback<T>

      A callback function that is called on any changes. When a key is first set oldValue will be undefined, and when a key is deleted newValue will be undefined.

    Returns Unsubscribe

    A function, that when called, will unsubscribe.

  • Watches the given key, calling callback on any changes.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • key: Key

      The key wo watch.

    • callback: OnDidChangeCallback<T[Key]>

      A callback function that is called on any changes. When a key is first set oldValue will be undefined, and when a key is deleted newValue will be undefined.

    Returns Unsubscribe

    A function, that when called, will unsubscribe.

  • Reset items to their default values, as defined by the defaults or schema option.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • Rest ...keys: Key[]

      The keys of the items to reset.

    Returns void

    See

    clear() to reset all items.

  • Set an item or multiple items at once.

    Type Parameters

    • Key extends string | number | symbol

    Parameters

    • key: Key
    • Optional value: T[Key]

      Must be JSON serializable. Trying to set the type undefined, function, or symbol will result in a TypeError.

    Returns void

  • Parameters

    • key: string
    • value: unknown

    Returns void

  • Parameters

    Returns void

Generated using TypeDoc