yolo to storing things in the browser


Figure out the best option for storing things in the browser and do it.

// @todo: add a not ridiculous example
var stor = require('stor/stor.set('actor', {username: 'yolo17'}, function(err){
  stor.get('actor', function(err, actor){

Backwards compat for localStorage.key. Get the key value in the store at position n.

Manually switch to a different backend

Get an adapter for your framework of choice.

var Backbone = require('backbone');
var sessionStorage = require('stor').use('session');
var historyBackend = sessionStorage.adapter('backbone', 'history');
var History = Backbone.Collection.extend({
  sync: historyBackend.sync
  • [ ] proper api for applying partial updates like Backbone's patch method.
  • [ ] id generation
  • [ ] namespace support in all stores translated where needed (eg localstorage -> use prefix, indexeddb -> use table name)