1.3.1 • Published 3 years ago

@egt-ukraine/storage v1.3.1

Weekly downloads
349
License
MIT
Repository
-
Last release
3 years ago

EGT Storage Module

Angular wrapper for localStorage, sessionStorage.

How to use?

Install:

npm i @egt-ukraine/storage or yarn add @egt-ukraine/storage

import { NgModule } from '@angular/core';

import { StorageModule } from '@egt-ukraine/storage';

@NgModule({
  imports: [
    StorageModule.forRoot(),
  ],
  exports: [],
  declarations: [],
})
export class CoreModule {}

Usage:

import { Injectable } from '@angular/core';

import { IWindowStorage, StorageRegistry } from '@egt-ukraine/storage';

@Injectable()
export class SomeService {
  private _storage: IWindowStorage;
  private _storageObjectKey: string = 'my-cool-variable-from-local-storage';
  private _storageType: string = 'local';

  constructor(private _storageRegistry: StorageRegistry) {
    this._storage = this._storageRegistry.getStorage(this._storageType);
  }

  public setSomeValue(someValue: string): void {
    this._storage.set(this._storageObjectKey, someValue);
  }

  public getSomeValue(): string {
    return this._storage.get(this._storageObjectKey);
  }
}
1.3.1

3 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago