browser-storage-utilities
Version:
A front-end library that provides utility methods to facilitate CRUD operations to data stored in the browser, and more.
16 lines (14 loc) • 883 B
text/typescript
import { StorageTypes } from '../enums/storage-types';
import { Observable } from 'rxjs';
import { IStorageNotifier } from 'interfaces/storage-typings';
export abstract class StorageBaseOperations<T> {
protected abstract add(key: string, item: T, expiry?: number, type?: StorageTypes): void;
protected abstract get(key: string, type?: StorageTypes): T;
protected abstract getStorage(type?: StorageTypes): Storage;
protected abstract getNotifierObservable(): Observable<IStorageNotifier<T>>;
protected abstract remove(key: string, type?: StorageTypes): void;
protected abstract removeAll(keys: string[], type?: StorageTypes): void;
protected abstract updateProp(key: string, propName: string, newValue: any, type?: StorageTypes): T;
protected abstract removeProp(key: string, propName: string, type?: StorageTypes): T;
protected abstract clear(type?: StorageTypes): void;
}