This package has been deprecated

Author message:

We have moved to a newer version called cstorage. Please checkout github link for details

jquerystorage

1.1.0 • Public • Published

jQueryStorage

JQuery storage plugin extends the default storage API to resolve cross-browser compatibility issues

Installation

npm install jquerystorage

How does it work?

jQueryStorage works as a standalone library as well as a jQuery plugin. There are few syntactical differences however. But fret not! You can use any syntax of your choice. The plugin automatically add missing dependencies (e.g. $) so that your code works at all times. Syntaxwise it's all so simple!

Set

To set key in local storage use

$.storage.set(key, value); // With or without jQuery
common.storage.set(key, value); // Alternative syntax

To set key in session storage (pass true flag as third parameter)

$.storage.set(key, value, true); // Stores in session
common.storage.set(key, value, true);

If storage is unavailable, the method automatically fallbacks to cookies as alternative storage

Get

To get any key value use

$.storage.get(key);
common.storage.get(key); // Alternative syntax

Get method checks all the available storages to get the value of key. It also parses the data if stored in JSON format.

jQueryStorage works on all major desktop and mobile browsers including IE.

Package Sidebar

Install

npm i jquerystorage

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

15.2 kB

Total Files

4

Last publish

Collaborators

  • scssyworks