Skip to content

Client-side storage the way it should be – using the HTML5 localStorage API.

License

Notifications You must be signed in to change notification settings

poiuytrez/loStorage.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

loStorage.js–client-side storage the way it should be

loStorage.js uses the HTML5 localStorage and sessionStorage APIs to provide a persistant client-side storage, mainly targeted at web apps. It has a cookie.js like interface. Some facts:

  • The minified version is 2.0 KiB large, 0.8 KB if minified and gzipped.
  • It has no dependencies.
  • You can store any kind of data with loStorage.js: Booleans, numbers, strings, arrays and plain objects. With the usual localStorage you can just read strings.
  • loStorage.js supports chaining.

Some example code

storage.empty().set({ // Chaining is awesome
  list: [1, 2],
  counter: 1
});

// Later

storage.push('list', 3, 4);
storage.increase('counter');

// And read the values:

storage.get('list'); // [1, 2, 3, 4]
storage.get('counter'); 2

WTF? Another micro library for client-side storage?

Yep, there are already some similar libraries out there, but I decided to write my own one because none didn't really fit my needs. loStorage.js only supports browers that are somewhat modern. Furthermore it has an interface that makes working with client-side storage a breeze.

Getting started

Read these wiki entries:

About

Client-side storage the way it should be – using the HTML5 localStorage API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published