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 = prefix: prefix id: id store: localStoragelssetkey valuelsgetkeylson'change'
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,
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
sessionStorage may also be used.
(store must have
length property and a
replicate with a normal
scuttlebutt/model, across anything that provides a Stream api.
//clientvar reconnect = require'reconnect'var LSSB = require'localstorage-scuttlebutt'var ls = ID prefixreconnectstreampipelscreateStreampipestreamconnect'/shoe'
//server.jsvar shoe = require'shoe'var Model = require'scuttlebutt/model'var model = SERVER_IDshoestreampipemodelcreateStreampipestreaminstallhttpcreateServerfscreateReadStream__dirname + '/index.html'piperesreqresumelisten3000