UNPKG

@igo2/core

Version:
47 lines (42 loc) 1.42 kB
import { ConfigService } from '@igo2/core/config'; import { BehaviorSubject } from 'rxjs'; import * as i0 from '@angular/core'; declare enum StorageScope { SESSION = "Session", LOCAL = "Local" } interface StorageOptions { key: string; } interface StorageServiceEvent { key?: string; scope: StorageScope; event: StorageServiceEventEnum; previousValue?: any; currentValue?: any; } declare enum StorageServiceEventEnum { ADDED = "Added", MODIFIED = "Modified", REMOVED = "Removed", CLEARED = "Cleared" } declare abstract class BaseStorage<T extends StorageOptions = StorageOptions> { protected options?: T; storageChange$: BehaviorSubject<StorageServiceEvent>; constructor(config: ConfigService); /** * Use to get the data found in storage file */ get(key: string, scope?: StorageScope): string | object | boolean | number; set(key: string, value: unknown, scope?: StorageScope): void; remove(key: string, scope?: StorageScope): void; clear(scope?: StorageScope): void; } declare class StorageService extends BaseStorage<StorageOptions> { constructor(); static ɵfac: i0.ɵɵFactoryDeclaration<StorageService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<StorageService>; } export { BaseStorage, StorageScope, StorageService, StorageServiceEventEnum }; export type { StorageOptions, StorageServiceEvent };