Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.44 KB

readme.md

File metadata and controls

44 lines (30 loc) · 1.44 KB

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: