UNPKG

persistent-typescript

Version:

An easy way to have persistent data on the browser and on nodejs

34 lines (33 loc) 1.35 kB
import { IPersistentOptions } from "./Persistent"; export declare class Storage { private persistentObjects; private persistentObjectsMetadata; constructor(); /** * Loads a persistent file to retrieve the classes information stored in it * @param options Persistent option, with theses options you can choose your saver, loader and the path to the file * @param force Force to reload the file */ loadPersistentFile(options: IPersistentOptions, force: boolean): void; /** * Stores the class instance to the storage * @param classInstance class instance to store * @param options Persistent option, with theses options you can choose your saver, loader and the path to the file */ store(classInstance: any, options: IPersistentOptions): void; /** * Retrieves a class instance by its name and its options * @param className class name * @param options Persistent option, with theses options you can choose your saver, loader and the path to the file */ getInstanceOfClass(className: string, options: IPersistentOptions): any | null; /** * Saves all classes stored in the storage using the plugin specified */ save(): void; /** * Returns the number of class saved */ getSize(): number; } export declare let storage: Storage;