observable-delta-stream

0.1.0 • Public • Published

observable-delta-stream

given an mobservable will emit diff changesets.

example

var deltas = require('observable-delta-stream')
var m = require('mobservable')
 
var foo = m.observable({ bar: 555, qux: [] })
 
deltas(foo).on('data', function (delta) {
  console.log('change:', delta)
})
 
foo.bar = 666
foo.qux.push(42)

outputs:

change: [ { type: 'put', key: [ 'bar' ], value: 555 },
  { type: 'put', key: [ 'qux' ], value: [] } ]
change: [ { type: 'put', key: [ 'bar' ], value: 666 } ]
change: [ { type: 'put', key: [ 'qux', '0' ], value: 42 } ]

api

var deltas = require('observable-delta-stream')

var stream = deltas(observable)

Returns a readable stream that will produce rows of delta arrays using changeset when observable is changed.

stream.destroy(err)

Destroys the stream and disposes the underlying reactive view associated with this stream.

license

mit

Readme

Keywords

none

Package Sidebar

Install

npm i observable-delta-stream

Weekly Downloads

4

Version

0.1.0

License

MIT

Last publish

Collaborators

  • acroyear2