UNPKG

@rb-mwindh/ngx-theme-manager

Version:

Angular component to switch between different theming stylesheets

76 lines (75 loc) 2.18 kB
import { OnDestroy } from '@angular/core'; import * as i0 from "@angular/core"; /** * StorageChangeEvent represents the change event of the storage. * * @interface * @group Public API */ export interface StorageChangeEvent { /** * The key of the item that was changed. */ key: string; /** * The value of the item before the change. */ oldValue: string | null; /** * The value of the item after the change. */ newValue: string | null; } /** * RbStorageService is a service that provides an observable stream of storage change events. * * @internal * @group Services */ export declare class StorageService implements OnDestroy { #private; /** * The observable stream of storage change events, shared among subscribers. * * @readonly */ readonly changes$: import("rxjs").Observable<StorageChangeEvent>; /** * Creates an instance of RbStorageService. * * @param {Document} document - the document object provided by Angular's DI. */ constructor(document: Document); /** * An Angular lifecycle hook that removes the storage event listener. * * @internal */ ngOnDestroy(): void; /** * Sets a key-value pair in the local storage and emits a change event. * * @param {string} key - The key to set * @param {string} newValue - The value to set */ setItem(key: string, newValue: string): void; /** * Gets the value of a key in the local storage. * * @param {string} key - The key to get the value of * @returns {(string | null)} The value of the key or null if it does not exist */ getItem(key: string): string | null; /** * Removes the value of a key from the local storage and emits a change event. * * @param {string} key - The key to remove */ removeItem(key: string): void; /** * Clears all keys from the local storage and emits a change event for each removed key. */ clear(): void; static ɵfac: i0.ɵɵFactoryDeclaration<StorageService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<StorageService>; }