UNPKG

angular-persistence

Version:

A library to handle persistence for Angular 2 applications.

77 lines (76 loc) 2.11 kB
import { IStorage } from './storage.interface'; import { IPersistenceContainer } from '../../abstracts/persistence.container'; /** * This is an internal implementation of a storage container. It takes a PersistenceContainer * (which has a subset of the functionality) and straps on an info object to keep track of * items that are added to the container. This class can be used for creating storage * containers within other storage containers. * * @export * @class PersistenceContainerImpl * @implements {IPersistenceContainer} * * @author Scott O'Bryan * @since 1.0 */ export declare class SubStorage implements IStorage { private _namespace; private _root; private _available; private _info; /** * Creates an instance of SubStorage. * @param {string} _namespace * @param {IPersistenceContainer} _root * @param {boolean} [_available=true] */ constructor(_namespace: string, _root: IPersistenceContainer, _available?: boolean); /** * Sets a value * * @param {string} key * @param {*} value * @returns {boolean} */ set(key: string, value: any): boolean; /** * Returns a value for a given key * * @param {string} key * @returns {*} */ get(key: string): any; /** * Removes a value for a given key * * @param {string} key * @returns {*} */ remove(key: string): any; /** * Removes any values which have been stored using this subStorage * container. */ removeAll(): void; /** * Returns true if the parent storage object is available and if the * available flag was set durring instantiation * * @returns {boolean} */ available(): boolean; /** * Returns true if the value is not undefined * * @param {string} key * @returns {boolean} */ exists(key: string): boolean; /** * Returns a list of un-namespaced keys that have been returned by this object. * * @returns {string[]} */ keys(): string[]; private _getNamespacedKey(key); }