UNPKG

ngx-store

Version:

Angular decorators to automagically keep variables in HTML5 LocalStorage, SessionStorage, cookies; injectable services for managing and listening to data changes and a bit more.

29 lines (28 loc) 1.32 kB
import { DecoratorConfig } from '../ngx-store.types'; import { WebStorage } from './storage/cookies-storage'; import { Observable, Subject } from 'rxjs'; import { NgxStorageEvent } from './storage/storage-event'; export declare type StorageName = 'localStorage' | 'sessionStorage' | 'cookiesStorage' | 'sharedStorage'; export declare class WebStorageUtility { protected _storage: WebStorage; constructor(storage: WebStorage, prefix?: string, previousPrefix?: string); protected _prefix: string; get prefix(): string; protected _changes: Subject<NgxStorageEvent>; get changes(): Observable<NgxStorageEvent>; get keys(): Array<string>; static getSettable(value: any): string; static getGettable(value: string): any; getStorage(): WebStorage; getStorageKey(key: string, prefix?: string): string; getStorageName(): StorageName; get(key: string, config?: DecoratorConfig): any; set<T>(key: string, value: T, config?: DecoratorConfig): T | null; remove(key: string, config?: DecoratorConfig): void; clear(): void; forEach(callbackFn: (value: any, key: string) => any): void; getSettable(value: any): string; getGettable(value: string): any; trimPrefix(key: string): string; protected emitEvent(key: string, newValue: any, oldValue?: any): void; }