UNPKG

@rero/ng-core

Version:

RERO angular core library.

99 lines (98 loc) 2.52 kB
import { CryptoJsService } from './crypto-js.service'; import * as i0 from "@angular/core"; /** * Service for managing data saved into local storage. */ export declare class LocalStorageService { protected cryptoService: CryptoJsService; /** * Event for set data on local storage */ private onSet; /** * Event for remove data on local storage */ private onRemove; /** * Event for clear on local storage */ private onClear; /** * On set observable * @return onSet subject observable */ get onSet$(): import("rxjs").Observable<LocalStorageEvent>; /** * On remove observable * @return onRemove subject observable */ get onRemove$(): import("rxjs").Observable<any>; /** * On clear observable * @return onClear subject observable */ get onClear$(): import("rxjs").Observable<any>; /** * Set a new key on LocalStorage * @param key - string * @param value - string * @return LocalStorageService */ set(key: string, value: any): this; /** * Update date of current object qualified by the key * @param key - string * @return LocalStorageService; */ updateDate(key: string): this; /** * Return the status of current object qualified by the key * @param key - string * @param seconds - number of seconds session expired * @return boolean */ isExpired(key: string, seconds: number): boolean; /** * Return JSON content of the LocaleStorage * @param key - string * @param field - string (default: data) * @return JSON */ get(key: string, field?: string): any; /** * Remove a key of LocaleStorage * @param key - string * @return LocalStorageService */ remove(key: string): this; /** * Clear LocaleStorage * @return LocalStorageService */ clear(): this; /** * has key in LocaleStorage * @param key - string * @return Boolean */ has(key: string): boolean; /** * Get local storage with the key * @param key - string */ private getItem; /** * Return keys of LocaleStorage * @return array */ private keys; static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>; } /** * LocalStorageEvent interface */ export interface LocalStorageEvent { key: string; data: any; }