UNPKG

@helgoland/core

Version:

56 lines (55 loc) 1.33 kB
/** * LocalStorage save objects with a given key * * @export */ export declare class LocalStorage { private localStorageEnabled; private defaults; constructor(); /** * Saves the object with the key in the local storage * * @param key * @param object * @returns successfull saving */ save(key: string, object: any): boolean; /** * loads the object with for the key * * @param key * @returns the object if exists, else null */ load<T>(key: string): T; /** * loads an array of objects for the key * * @param key * @returns the array of objects if exists, else null */ loadArray<T>(key: string): T[]; /** * load a textual string for the given key * * @param key * @returns the string if exists, else null */ loadTextual(key: string): string; /** * clears the complete local storage */ clearStorage(): void; /** * removes the item for the specified key * @param key */ removeItem(key: string): void; /** * sets a default value for the given key, which will be delivered, if nothing is stored in localstorage for the key * * @param key * @param object */ protected defineDefault(key: string, object: any): void; }