Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • StateAccessor

Index

Methods

  • clear(): Promise<undefined | number>
  • delete(key: string): Promise<boolean>
  • get<T>(key: string): Promise<undefined | T>
  • getAll<T>(): Promise<Map<string, T>>
  • keys(): Promise<string[]>
  • set<T>(key: string, value: T): Promise<boolean>
  • Store the value on a specific key. Return true if the old value is updated, false if it's newly stored on the key.

    Type parameters

    • T

    Parameters

    • key: string
    • value: T

    Returns Promise<boolean>

  • update<T>(key: string, updator: (state: undefined | T) => T): Promise<T>
  • update<T>(key: string, updator: (state: undefined | T) => undefined | T): Promise<undefined | T>
  • Update the value of a specific key by an undator funcction. The updator receives the original value (undefined if not existed) and return the new value. Depends on the new value, 3 kinds of action will be executed:

    • undefined; delete the data on the key.
    • original value (compared with ===); no changes.
    • any other value; the new value will be stored.

    Type parameters

    • T

    Parameters

    • key: string
    • updator: (state: undefined | T) => T
        • (state: undefined | T): T
        • Parameters

          • state: undefined | T

          Returns T

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • key: string
    • updator: (state: undefined | T) => undefined | T
        • (state: undefined | T): undefined | T
        • Parameters

          • state: undefined | T

          Returns undefined | T

    Returns Promise<undefined | T>

Generated using TypeDoc