nxkit
Version:
This is a collection of tools, independent of any other libraries
40 lines (39 loc) • 1.03 kB
TypeScript
export interface IStorage {
get<T = any>(key: string, defaultValue?: T): T;
has(key: string): boolean;
set(key: string, value: any): void;
delete(key: string): void;
clear(): void;
commit(): void;
}
/**
* @class Storage
*/
export declare class Storage implements IStorage {
private m_path;
private m_prefix;
private m_change;
private m_value;
private m_sync;
constructor(path?: string);
get(key: string, defaultValue?: any): any;
has(key: string): boolean;
set(key: string, value: any): void;
del(key: string): void;
delete(key: string): void;
clear(): void;
commit(): void;
save(): void;
}
declare const _default: {
readonly shared: IStorage;
setShared: (value: Storage) => void;
get: (key: string, defaultValue?: any) => any;
has: (key: string) => boolean;
set: (key: string, value: any) => void;
del: (key: string) => void;
clear: () => void;
save: () => void;
commit: () => void;
};
export default _default;