gossip-object
Version:
replicate an object with scuttlebutt
48 lines (26 loc) • 1.02 kB
Markdown
replicate an object with scuttlebutt
npm install gossip-object
```js
var Model = require('gossip-object')
```
Make yourself a fresh one.
set a value, with either a path (an array of keys, diving into recursive objects) or a plain key
### model.get(key, value, default)
### model.get(path, value, default)
get a value, with either a path (an array of keys, diving into recursive objects) or a plain key
### model.delete(key)
### model.delete(path)
delete a value, with either a path (an array of keys, diving into recursive objects) or a plain key
### model.toJSON()
get all the data plain JS object
### model.on('change', function(old))
get notified when changes happen, you're passed the .toJSON() from before the change so you can tell the difference.
### model.createStream()
[Scuttlebutt replication](https://github.com/dominictarr/scuttlebutt#replication)