ngx-webstorage
- Version 19.0.1
- Published
- 93.6 kB
- 1 dependency
- MIT license
Install
npm i ngx-webstorage
yarn add ngx-webstorage
pnpm add ngx-webstorage
Overview
### Local and session storage - Angular service This library provides an easy to use service to manage the web storages (local and session) from your Angular application. It provides also two decorators to synchronize the component attributes and the web
Index
Variables
Functions
Classes
Interfaces
Enums
Type Aliases
Variables
variable InvalidStrategyError
const InvalidStrategyError: string;
variable LIB_CONFIG
const LIB_CONFIG: InjectionToken<NgxWebstorageConfiguration>;
variable LOCAL_STORAGE
const LOCAL_STORAGE: InjectionToken<WebStorage>;
variable SESSION_STORAGE
const SESSION_STORAGE: InjectionToken<WebStorage>;
variable STORAGE_STRATEGIES
const STORAGE_STRATEGIES: InjectionToken<StorageStrategy<any>>;
variable StorageStrategyStubName
const StorageStrategyStubName: string;
Functions
function LocalStorage
LocalStorage: ( key?: string, defaultValue?: any) => (prototype: any, propName: any) => void;
function makeNgxWebstorageFeature
makeNgxWebstorageFeature: <FeatureKind extends NgxWebstorageFeatureKind>( kind: FeatureKind, providers: Provider[]) => NgxWebstorageFeature<FeatureKind>;
function provideNgxWebstorage
provideNgxWebstorage: ( ...features: NgxWebstorageFeature<NgxWebstorageFeatureKind>[]) => any;
Provide ngx-webstorage basic features.
- You can customise the configuration with the
withConfiguration
feature. - You can enable theLocalStorage
features with thewithLocalStorage
feature. - You can enable theSessionStorage
features with thewithSessionStorage
feature.config { prefix: 'ngx-webstorage', separator: '|', caseSensitive: false }
function SessionStorage
SessionStorage: ( key?: string, defaultValue?: any) => (prototype: any, propName: any) => void;
function withLocalStorage
withLocalStorage: () => NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.LocalStorage>;
Provides everything necessary to use the
LocalStorage
features.
function withNgxWebstorageConfig
withNgxWebstorageConfig: ( config: NgxWebstorageConfiguration) => NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.Config>;
function withSessionStorage
withSessionStorage: () => NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.SessionStorage>;
Classes
class AsyncStorage
class AsyncStorage implements StorageService {}
constructor
constructor(strategy: StorageStrategy<any>);
property strategy
protected strategy: StorageStrategy<any>;
method clear
clear: (key?: string) => Observable<void>;
method getStrategyName
getStrategyName: () => string;
method observe
observe: (key: string) => Observable<any>;
method retrieve
retrieve: (key: string) => Observable<any>;
method store
store: (key: string, value: any) => Observable<any>;
class CompatHelper
class CompatHelper {}
method isStorageAvailable
static isStorageAvailable: (storage: WebStorage) => boolean;
class InMemoryStorageStrategy
class InMemoryStorageStrategy implements StorageStrategy<any> {}
constructor
constructor(cache: StrategyCacheService);
property cache
protected cache: StrategyCacheService;
property isAvailable
isAvailable: boolean;
property keyChanges
readonly keyChanges: Subject<string>;
property name
readonly name: string;
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<InMemoryStorageStrategy, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<InMemoryStorageStrategy>;
property strategyName
static readonly strategyName: string;
method clear
clear: () => Observable<void>;
method del
del: (key: string) => Observable<void>;
method get
get: (key: string) => Observable<any>;
method set
set: (key: string, value: any) => Observable<any>;
class LocalStorageService
class LocalStorageService extends SyncStorage {}
class LocalStorageStrategy
class LocalStorageStrategy extends BaseSyncStorageStrategy {}
constructor
constructor( storage: WebStorage, cache: StrategyCacheService, platformId: any, zone: NgZone);
property cache
protected cache: StrategyCacheService;
property name
readonly name: string;
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageStrategy, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageStrategy>;
property platformId
protected platformId: any;
property storage
protected storage: WebStorage;
property strategyName
static readonly strategyName: string;
property zone
protected zone: NgZone;
method listenExternalChanges
protected listenExternalChanges: () => void;
class SessionStorageService
class SessionStorageService extends SyncStorage {}
class SessionStorageStrategy
class SessionStorageStrategy extends BaseSyncStorageStrategy {}
constructor
constructor( storage: WebStorage, cache: StrategyCacheService, platformId: any, zone: NgZone);
property cache
protected cache: StrategyCacheService;
property name
readonly name: string;
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageStrategy, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageStrategy>;
property platformId
protected platformId: any;
property storage
protected storage: WebStorage;
property strategyName
static readonly strategyName: string;
property zone
protected zone: NgZone;
method listenExternalChanges
protected listenExternalChanges: () => void;
class StorageStrategyStub
class StorageStrategyStub implements StorageStrategy<any> {}
constructor
constructor(name?: string);
property isAvailable
readonly isAvailable: boolean;
property keyChanges
readonly keyChanges: Subject<string>;
property name
readonly name: string;
property store
store: any;
method clear
clear: () => Observable<void>;
method del
del: (key: string) => Observable<void>;
method get
get: (key: string) => Observable<any>;
method set
set: (key: string, value: any) => Observable<any>;
class StorageStub
class StorageStub implements WebStorage {}
property length
readonly length: number;
property store
store: { [prop: string]: any };
method clear
clear: () => void;
method getItem
getItem: (key: string) => string | null;
method key
key: (index: number) => string | null;
method removeItem
removeItem: (key: string) => void;
method setItem
setItem: (key: string, value: string) => void;
class StrategyCacheService
class StrategyCacheService {}
property caches
protected caches: { [name: string]: StrategyCache };
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<StrategyCacheService, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<StrategyCacheService>;
method clear
clear: (strategyName: string) => void;
method del
del: (strategyName: string, key: string) => void;
method get
get: (strategyName: string, key: string) => any;
method getCacheStore
protected getCacheStore: (strategyName: string) => StrategyCache;
method set
set: (strategyName: string, key: string, value: any) => void;
class StrategyIndex
class StrategyIndex {}
constructor
constructor(strategies: StorageStrategy<any>[]);
property index
static index: { [name: string]: StorageStrategy<any> };
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<StrategyIndex, [{ optional: true }]>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<StrategyIndex>;
property registration$
readonly registration$: Subject<string>;
property strategies
protected strategies: StorageStrategy<any>[];
method clear
static clear: (name?: string) => void;
method get
static get: (name: string) => StorageStrategy<any>;
method getStrategy
getStrategy: (name: string) => StorageStrategy<any>;
method hasRegistredStrategies
static hasRegistredStrategies: () => boolean;
method indexStrategies
indexStrategies: () => void;
method indexStrategy
indexStrategy: ( name: string, overrideIfExists?: boolean) => StorageStrategy<any>;
method isStrategyRegistered
static isStrategyRegistered: (name: string) => boolean;
method register
register: ( name: string, strategy: StorageStrategy<any>, overrideIfExists?: boolean) => void;
method set
static set: (name: string, strategy: any) => void;
class SyncStorage
class SyncStorage implements StorageService {}
constructor
constructor(strategy: StorageStrategy<any>);
property strategy
protected strategy: StorageStrategy<any>;
method clear
clear: (key?: string) => void;
method getStrategyName
getStrategyName: () => string;
method observe
observe: (key: string) => Observable<any>;
method retrieve
retrieve: (key: string) => any;
method store
store: (key: string, value: any) => any;
Interfaces
interface StorageStrategy
interface StorageStrategy<T> {}
property isAvailable
readonly isAvailable: boolean;
property keyChanges
readonly keyChanges: Subject<string>;
property name
readonly name: string;
method clear
clear: () => Observable<void>;
method del
del: (key: string) => Observable<void>;
method get
get: (key: string) => Observable<T>;
method set
set: (key: string, value: T) => Observable<T>;
interface StrategyCache
interface StrategyCache {}
index signature
[key: string]: any;
Enums
enum InternalNgxWebstorageFeatureKind
enum InternalNgxWebstorageFeatureKind { Config = 1, LocalStorage = 2, SessionStorage = 3,}
enum StorageStrategies
enum StorageStrategies { Local = 'local_strategy', Session = 'session_strategy', InMemory = 'in_memory_strategy',}
Type Aliases
type NgxWebstorageFeature
type NgxWebstorageFeature<FeatureKind extends NgxWebstorageFeatureKind> = { kind: FeatureKind; providers: Provider[];};
type NgxWebstorageFeatureKind
type NgxWebstorageFeatureKind = string | InternalNgxWebstorageFeatureKind;
Package Files (19)
- index.d.ts
- lib/constants/strategy.d.ts
- lib/core/interfaces/storageStrategy.d.ts
- lib/core/nativeStorage.d.ts
- lib/core/strategyCache.d.ts
- lib/core/templates/asyncStorage.d.ts
- lib/core/templates/syncStorage.d.ts
- lib/decorators.d.ts
- lib/helpers/compat.d.ts
- lib/provider.d.ts
- lib/services/localStorage.d.ts
- lib/services/sessionStorage.d.ts
- lib/services/strategyIndex.d.ts
- lib/strategies/inMemory.d.ts
- lib/strategies/index.d.ts
- lib/strategies/localStorage.d.ts
- lib/strategies/sessionStorage.d.ts
- stubs/storage.stub.d.ts
- stubs/storageStrategy.stub.d.ts
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ngx-webstorage
.
- Markdown[](https://www.jsdocs.io/package/ngx-webstorage)
- HTML<a href="https://www.jsdocs.io/package/ngx-webstorage"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3721 ms. - Missing or incorrect documentation? Open an issue for this package.