replicate localStorage with scuttlebutt


replicate localstorage through scuttlebutt.

The same api as scuttlebutt/model but data is saved in the browser using local storage.

var LSSB = require('localstorage-scuttlebutt')
var ls = new LSSB({prefix: prefix, id: id, store: localStorage})
ls.set(key, value)
ls.on('change', function (keyvalue) {

prefix is the name of this instance. If you are using multiple instances, or have other data in localStorage you need to set this. By default, prefix='_lss'.

id is optional, but if provided, it should represent the user session. (by default, it's remembered in localStorage, so the same value will be used next time)

store defaults to localStorage, but sessionStorage may also be used. (store must have length property and a key() method.

replicate with a normal scuttlebutt/model, across anything that provides a Stream api.

var reconnect = require('reconnect')
var LSSB = require('localstorage-scuttlebutt')
var ls = new LSSB(ID, prefix)
reconnect(function (stream) {
var shoe = require('shoe')
var Model = require('scuttlebutt/model')
var model = new Model(SERVER_ID)
shoe(function (stream) {
}).install(http.createServer(function (reqres) {
  fs.createReadStream(__dirname + '/index.html').pipe(res)