@stolbivi/pirojok
Version:
Some minimalistic library used to build chrome extensions, covers some popular Chrome Extension API
53 lines (52 loc) • 2.08 kB
TypeScript
/**
* A utility class for managing Chrome extension storage operations.
* Provides methods for both sync and local storage operations.
*/
export declare class Storage {
/**
* Clears all data from Chrome's sync storage.
* @returns A promise that resolves when the storage is cleared
*/
clearStorage(): Promise<void>;
/**
* Removes specific keys from Chrome's sync storage.
* @param keys - A single key or array of keys to remove from storage
* @returns A promise that resolves when the keys are removed
*/
removeFromStorage(keys: string | string[]): Promise<void>;
/**
* Saves data to Chrome's sync storage.
* @param data - The data object to store
* @returns A promise that resolves with the stored data
*/
saveToStorage(data: object): Promise<unknown>;
/**
* Reads data from Chrome's sync storage.
* @param keys - A single key, array of keys, or object with default values
* @returns A promise that resolves with the retrieved data
*/
readFromStorage(keys: string | object | string[]): Promise<unknown>;
/**
* Clears all data from Chrome's local storage.
* @returns A promise that resolves when the storage is cleared
*/
clearLocalStorage(): Promise<void>;
/**
* Removes specific keys from Chrome's local storage.
* @param keys - A single key or array of keys to remove from storage
* @returns A promise that resolves when the keys are removed
*/
removeFromLocalStorage(keys: string | string[]): Promise<void>;
/**
* Saves data to Chrome's local storage.
* @param data - The data object to store
* @returns A promise that resolves with the stored data
*/
saveToLocalStorage(data: object): Promise<unknown>;
/**
* Reads data from Chrome's local storage.
* @param keys - A single key, array of keys, or object with default values
* @returns A promise that resolves with the retrieved data
*/
readFromLocalStorage(keys: string | object | string[]): Promise<unknown>;
}