Interface LocalStorage

Proxy for the local storage. Only elements owned by the plugin can be stored and accessed. Warning: other plugins won't be able to access this information but the user could potentialy access the data through the browser information.

interface LocalStorage {
    getItem(key: string): string;
    setItem(key: string, value: unknown): void;
    removeItem(key: string): void;
    getKeys(): string[];
}

Methods

  • Retrieve the element with the given key Requires the allow:localstorage permission.

    Parameters

    • key: string

    Returns string

  • Set the data given the key. If the value already existed it will be overriden. The value will be stored in a string representation. Requires the allow:localstorage permission.

    Parameters

    • key: string
    • value: unknown

    Returns void

  • Remove the value stored in the key. Requires the allow:localstorage permission.

    Parameters

    • key: string

    Returns void

  • Return all the keys for the data stored by the plugin. Requires the allow:localstorage permission.

    Returns string[]