Options
All
  • Public
  • Public/Protected
  • All
Menu

External module chrome/storage

Manage items in storage

Index

Variables

Functions

Variables

Const chromep

chromep: ChromePromise = new ChromePromise()

Functions

asyncGet

  • asyncGet<T>(key: string): Promise<null | T>
  • asyncGet<T>(key: string, def: boolean): Promise<boolean>
  • asyncGet<T>(key: string, def: number): Promise<number>
  • asyncGet<T>(key: string, def: string): Promise<string>
  • asyncGet<T>(key: string, def: T): Promise<T>
  • Get a value from chrome.storage.local

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    Returns Promise<null | T>

    value from storage, null if not found unless default is provided

  • Get a value from chrome.storage.local

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    • def: boolean

      optional default value if not found

    Returns Promise<boolean>

    value from storage, null if not found unless default is provided

  • Get a value from chrome.storage.local

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    • def: number

      optional default value if not found

    Returns Promise<number>

    value from storage, null if not found unless default is provided

  • Get a value from chrome.storage.local

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    • def: string

      optional default value if not found

    Returns Promise<string>

    value from storage, null if not found unless default is provided

  • Get a value from chrome.storage.local

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    • def: T

      optional default value if not found

    Returns Promise<T>

    value from storage, null if not found unless default is provided

asyncSet

  • asyncSet<T>(key: string, value: T, keyBool?: undefined | string): Promise<boolean>
  • Save a value to chrome.storage.local only if there is enough room

    https://developer.chrome.com/apps/storage

    Type parameters

    • T

    Parameters

    • key: string

      data key

    • value: T

      data value

    • Optional keyBool: undefined | string

      optional key to a boolean value that is true if the primary key has non-empty value

    Returns Promise<boolean>

    true if value was set successfully

get

  • get<T>(key: string): null | T
  • get<T>(key: string, def: boolean): boolean
  • get<T>(key: string, def: number): number
  • get<T>(key: string, def: string): string
  • get<T>(key: string, def: T): T
  • Get a json parsed value from localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to get value for

    Returns null | T

    json object or string, null if key does not exist and no default specified

  • Get a json parsed value from localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to get value for

    • def: boolean

      optional value if key not found

    Returns boolean

    json object or string, null if key does not exist and no default specified

  • Get a json parsed value from localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to get value for

    • def: number

      optional value if key not found

    Returns number

    json object or string, null if key does not exist and no default specified

  • Get a json parsed value from localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to get value for

    • def: string

      optional value if key not found

    Returns string

    json object or string, null if key does not exist and no default specified

  • Get a json parsed value from localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to get value for

    • def: T

      optional value if key not found

    Returns T

    json object or string, null if key does not exist and no default specified

safeSet

  • safeSet<T>(key: string, value: T, keyBool?: undefined | string): boolean
  • Save a value to localStorage only if there is enough room

    Type parameters

    • T

    Parameters

    • key: string

      localStorage Key

    • value: T

      value to save

    • Optional keyBool: undefined | string

      optional key to a boolean value that is true if the primary key has non-empty value

    Returns boolean

    true if value was set successfully

set

  • set<T>(key: string, value: null | T): void
  • JSON stringify and save a value to localStorage

    Type parameters

    • T

    Parameters

    • key: string

      key to set value for

    • value: null | T

      new value, if null remove item

    Returns void

Generated using TypeDoc