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.
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
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.
Read these wiki entries: