ngx-webstorage

  • Version 9.0.0
  • Published
  • 238 kB
  • 1 dependency
  • MIT license

Install

npm i ngx-webstorage
yarn add ngx-webstorage
pnpm add ngx-webstorage

Overview

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 storages.

Index

Variables

variable InvalidStrategyError

const InvalidStrategyError: string;

    variable LIB_CONFIG

    const LIB_CONFIG: any;

      variable LOCAL_STORAGE

      const LOCAL_STORAGE: any;

        variable SESSION_STORAGE

        const SESSION_STORAGE: any;

          variable STORAGE_STRATEGIES

          const STORAGE_STRATEGIES: any;

            variable StorageStrategyStubName

            const StorageStrategyStubName: string;

              Functions

              function appInit

              appInit: (index: StrategyIndex) => () => { [name: string]: any };

                function LocalStorage

                LocalStorage: (
                key?: string,
                defaultValue?: any
                ) => (prototype: any, propName: any) => void;

                  function SessionStorage

                  SessionStorage: (
                  key?: string,
                  defaultValue?: any
                  ) => (prototype: any, propName: any) => void;

                    Classes

                    class AsyncStorage

                    class AsyncStorage implements StorageService {}

                      constructor

                      constructor(strategy: StorageStrategy<any>);

                        property strategy

                        protected strategy: StorageStrategy<any>;

                          method clear

                          clear: (key?: string) => any;

                            method getStrategyName

                            getStrategyName: () => string;

                              method observe

                              observe: (key: string) => any;

                                method retrieve

                                retrieve: (key: string) => any;

                                  method store

                                  store: (key: string, value: any) => 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: any;

                                                  property name

                                                  readonly name: string;

                                                    property ɵfac

                                                    static ɵfac: any;

                                                      property ɵprov

                                                      static ɵprov: any;

                                                        property strategyName

                                                        static readonly strategyName: string;

                                                          method clear

                                                          clear: () => any;

                                                            method del

                                                            del: (key: string) => any;

                                                              method get

                                                              get: (key: string) => any;

                                                                method set

                                                                set: (key: string, value: any) => any;

                                                                  class LocalStorageService

                                                                  class LocalStorageService extends SyncStorage {}

                                                                    class LocalStorageStrategy

                                                                    class LocalStorageStrategy extends BaseSyncStorageStrategy {}

                                                                      constructor

                                                                      constructor(
                                                                      storage: WebStorage,
                                                                      cache: StrategyCacheService,
                                                                      platformId: any,
                                                                      zone: any
                                                                      );

                                                                        property cache

                                                                        protected cache: StrategyCacheService;

                                                                          property name

                                                                          readonly name: string;

                                                                            property ɵfac

                                                                            static ɵfac: any;

                                                                              property ɵprov

                                                                              static ɵprov: any;

                                                                                property platformId

                                                                                protected platformId: any;

                                                                                  property storage

                                                                                  protected storage: WebStorage;

                                                                                    property strategyName

                                                                                    static readonly strategyName: string;

                                                                                      property zone

                                                                                      protected zone: any;

                                                                                        method listenExternalChanges

                                                                                        protected listenExternalChanges: () => void;

                                                                                          class NgxWebstorageModule

                                                                                          class NgxWebstorageModule {}

                                                                                            constructor

                                                                                            constructor(index: StrategyIndex, config: NgxWebstorageConfiguration);

                                                                                              property ɵfac

                                                                                              static ɵfac: any;

                                                                                                property ɵinj

                                                                                                static ɵinj: any;

                                                                                                  property ɵmod

                                                                                                  static ɵmod: any;

                                                                                                    method forRoot

                                                                                                    static forRoot: (config?: NgxWebstorageConfiguration) => any;

                                                                                                      class SessionStorageService

                                                                                                      class SessionStorageService extends SyncStorage {}

                                                                                                        class SessionStorageStrategy

                                                                                                        class SessionStorageStrategy extends BaseSyncStorageStrategy {}

                                                                                                          constructor

                                                                                                          constructor(
                                                                                                          storage: WebStorage,
                                                                                                          cache: StrategyCacheService,
                                                                                                          platformId: any,
                                                                                                          zone: any
                                                                                                          );

                                                                                                            property cache

                                                                                                            protected cache: StrategyCacheService;

                                                                                                              property name

                                                                                                              readonly name: string;

                                                                                                                property ɵfac

                                                                                                                static ɵfac: any;

                                                                                                                  property ɵprov

                                                                                                                  static ɵprov: any;

                                                                                                                    property platformId

                                                                                                                    protected platformId: any;

                                                                                                                      property storage

                                                                                                                      protected storage: WebStorage;

                                                                                                                        property strategyName

                                                                                                                        static readonly strategyName: string;

                                                                                                                          property zone

                                                                                                                          protected zone: any;

                                                                                                                            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: any;

                                                                                                                                      property name

                                                                                                                                      readonly name: string;

                                                                                                                                        property store

                                                                                                                                        store: any;

                                                                                                                                          method clear

                                                                                                                                          clear: () => any;

                                                                                                                                            method del

                                                                                                                                            del: (key: string) => any;

                                                                                                                                              method get

                                                                                                                                              get: (key: string) => any;

                                                                                                                                                method set

                                                                                                                                                set: (key: string, value: any) => 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: any;

                                                                                                                                                                        property ɵprov

                                                                                                                                                                        static ɵprov: any;

                                                                                                                                                                          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: any;

                                                                                                                                                                                            property ɵprov

                                                                                                                                                                                            static ɵprov: any;

                                                                                                                                                                                              property registration$

                                                                                                                                                                                              readonly registration$: any;

                                                                                                                                                                                                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) => 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: () => any;

                                                                                                                                                                                                                                              method del

                                                                                                                                                                                                                                              del: (key: string) => any;

                                                                                                                                                                                                                                                method get

                                                                                                                                                                                                                                                get: (key: string) => any;

                                                                                                                                                                                                                                                  method set

                                                                                                                                                                                                                                                  set: (key: string, value: T) => any;

                                                                                                                                                                                                                                                    interface StrategyCache

                                                                                                                                                                                                                                                    interface StrategyCache {}

                                                                                                                                                                                                                                                      index signature

                                                                                                                                                                                                                                                      [key: string]: any;

                                                                                                                                                                                                                                                        Enums

                                                                                                                                                                                                                                                        enum StorageStrategies

                                                                                                                                                                                                                                                        enum StorageStrategies {
                                                                                                                                                                                                                                                        Local = 'local_strategy',
                                                                                                                                                                                                                                                        Session = 'session_strategy',
                                                                                                                                                                                                                                                        InMemory = 'in_memory_strategy',
                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                          member InMemory

                                                                                                                                                                                                                                                          InMemory = 'in_memory_strategy'

                                                                                                                                                                                                                                                            member Local

                                                                                                                                                                                                                                                            Local = 'local_strategy'

                                                                                                                                                                                                                                                              member Session

                                                                                                                                                                                                                                                              Session = 'session_strategy'

                                                                                                                                                                                                                                                                Package Files (19)

                                                                                                                                                                                                                                                                Dependencies (1)

                                                                                                                                                                                                                                                                Dev Dependencies (0)

                                                                                                                                                                                                                                                                No dev dependencies.

                                                                                                                                                                                                                                                                Peer Dependencies (2)

                                                                                                                                                                                                                                                                Badge

                                                                                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto 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
                                                                                                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](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>