ngx-webstorage
Version:
### 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
29 lines (28 loc) • 1.7 kB
TypeScript
import { InjectionToken, Provider } from '@angular/core';
import { NgxWebstorageConfiguration } from './config';
export declare const LIB_CONFIG: InjectionToken<NgxWebstorageConfiguration>;
export declare enum InternalNgxWebstorageFeatureKind {
Config = 1,
LocalStorage = 2,
SessionStorage = 3
}
export type NgxWebstorageFeatureKind = string | InternalNgxWebstorageFeatureKind;
export type NgxWebstorageFeature<FeatureKind extends NgxWebstorageFeatureKind> = {
kind: FeatureKind;
providers: Provider[];
};
/**
* Provide ngx-webstorage basic features.
*
* - You can customise the configuration with the `withConfiguration` feature.
* - You can enable the `LocalStorage` features with the `withLocalStorage` feature.
* - You can enable the `SessionStorage` features with the `withSessionStorage` feature.
*
* @default config { prefix: 'ngx-webstorage', separator: '|', caseSensitive: false }
*/
export declare function provideNgxWebstorage(...features: NgxWebstorageFeature<NgxWebstorageFeatureKind>[]): import("@angular/core").EnvironmentProviders;
export declare function makeNgxWebstorageFeature<FeatureKind extends NgxWebstorageFeatureKind>(kind: FeatureKind, providers: Provider[]): NgxWebstorageFeature<FeatureKind>;
export declare function withNgxWebstorageConfig(config: NgxWebstorageConfiguration): NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.Config>;
/** Provides everything necessary to use the `LocalStorage` features. */
export declare function withLocalStorage(): NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.LocalStorage>;
export declare function withSessionStorage(): NgxWebstorageFeature<InternalNgxWebstorageFeatureKind.SessionStorage>;