0.4.0 • Published 3 years ago

@fnx-components/storage v0.4.0

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

FnxStorage Service

A service library for saving data in browser storage in your angular project. This library was generated with Angular CLI

Installing

In your Angular project run

npm i --save @fnx-components/storage

Getting Started

After installing it you need to inject the most appropriate service in your controller

Services available:

NameImport
FnxSessionStorageServiceimport { FnxSessionStorageService } from '@fnx-components/session-storage.service';
...
import { FnxSessionStorageService } from '@fnx-components/storage';

constructor(
    ...
    private readonly fnxSessionStorageService: FnxSessionStorageService
) { }

then you can start saving your data

// Your data
const martinSeamusMcflyData = { name: 'Martin Seamus McFly ', age: '17', gender: 'Male', job: 'Student' };

// Save data
this.fnxSessionStorageService.setItem(JSON.stringify(martinSeamusMcflyData), 'secretKey');

// Retrieve saved data
const savedData = JSON.parse(this.fnxSessionStorageService.getItem('secretKey'));

// Remove data
this.fnxSessionStorageService.removeItem('secretKey');
0.4.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago