Skip to content

D-Mobilelab/storage-pro

Repository files navigation

storage-pro

Build Status Coverage Status npm version Bower version GitHub version

storage-pro is a library to set and get data in different ways.

Usage

Storage.init({
	type: 'cookie',
	logger: console,
	verbose: true
});

// default storage (indicated from 'type' attribute in init)
Storage.set('country', 'it');
Storage.get('country');
Storage.delete('country');

Storage.setMultiple({
	first: 'one',
	second: 'two'
});
Storage.getMultiple(['first', 'second']);

// cookie
Storage.set('isLogged', true, { type: 'cookie' });
Storage.set('twodays', 2, { type: 'cookie', exdays: 2 });
Storage.set('twohours', true, { type: 'cookie', exhours: 2 });
Storage.set('twominutes', true, { type: 'cookie', exminutes: 2 });
Storage.get('isLogged', { type: 'cookie' });
Storage.delete('isLogged', { type: 'cookie' });

// localstorage
Storage.set('isLogged', true, { type: 'localstorage' });
Storage.get('isLogged', { type: 'localstorage' });
Storage.delete('isLogged', { type: 'localstorage' });

// jsobject
Storage.set('environment', 'webapp', { type: 'jsobject' });
Storage.get('environment', { type: 'jsobject' });
Storage.delete('environment', { type: 'jsobject' });

Storage.isLocalStorageSupported()

Installation

NPM

npm install --save storage-pro

You can found the library ready for production on node_modules/storage-pro/dist/dist.js

Bower

bower install --save storage-pro

You can found the library ready for production on bower_components/storage-pro/dist/dist.js

Documentation

To read documentation, go to:

http://d-mobilelab.github.io/storage-pro/1.0.0

Replace 1.0.0 with the version of the documentation you want to read.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published