mcbopomofoweb
    Preparing search index...

    A class to store large objects in chrome.storage.sync.

    Index

    Constructors

    Properties

    maxBytes: number = chrome.storage.sync.QUOTA_BYTES
    maxBytesPerKey: number = chrome.storage.sync.QUOTA_BYTES_PER_ITEM
    version: "1.0"

    Methods

    • A basic hash function.

      Parameters

      • str: string

        The string to be hashed.

      Returns number

      The hash of the string.

    • Calculates the maximum length of a chunk.

      Parameters

      • key: string

        The key of the chunk.

      • maxLength: number

        The maximum length of the chunk.

      Returns number

      The maximum length of the chunk.

    • Clears all objects from chrome.storage.sync.

      Parameters

      • callback: () => void

        The callback function.

      Returns void

    • Extracts the keys from a split object.

      Parameters

      • splitObjects: any

        The split object.

      Returns string[]

      The keys of the object.

    • Gets an object from chrome.storage.sync.

      Parameters

      • keys: string[]

        The keys of the object to be retrieved.

      • callback: (arg: { [k: string]: any }) => void

        The callback function.

      Returns void

    • Gets the bytes in use by an object in chrome.storage.sync.

      Parameters

      • keys: string[]

        The keys of the object.

      • callback: () => void

        The callback function.

      Returns void

    • Gets the keys of an object.

      Parameters

      • keys: any

        The object.

      Returns string[]

      The keys of the object.

    • Gets the request keys for a given set of keys.

      Parameters

      • keys: string[]

        The keys.

      Returns string[]

      The request keys.

    • Gets the storage key for a given key and postfix.

      Parameters

      • key: string

        The key.

      • postfix: string

        The postfix.

      Returns string

      The storage key.

    • Reconstructs an object from its chunks.

      Parameters

      • splitObjects: any

        The object with the split chunks.

      • inKeys: undefined | string[] = undefined

        The keys of the object to be reconstructed.

      Returns { [k: string]: any }

      The reconstructed object.

    • Removes an object from chrome.storage.sync.

      Parameters

      • keys: string[]

        The keys of the object to be removed.

      • callback: () => void

        The callback function.

      Returns void

    • Sets an object in chrome.storage.sync.

      Parameters

      • items: { [k: string]: any }

        The object to be stored.

      • callback: () => void

        The callback function.

      Returns void

    • Splits an object into smaller chunks to be stored in chrome.storage.sync.

      Parameters

      • obj: any

        The object to be stored.

      • maxLength: number

        The maximum length of each chunk.

      Returns object

      The object with the split chunks.