@fnx-components/storage
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

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:

Name Import
FnxSessionStorageService import { 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');

Readme

Keywords

none

Package Sidebar

Install

npm i @fnx-components/storage

Weekly Downloads

0

Version

0.4.0

License

none

Unpacked Size

20.2 kB

Total Files

15

Last publish

Collaborators

  • ricardorinco