0.1.0 • Published 11 years ago

computed-value-stream v0.1.0

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

computed-value-stream

Stability: 1 - Experimental

Stability as defined by Node.js

A writable stream with objectMode=true that emits update events instead of writing to the stream buffer. Additionally, it stores the latest object in a property called value.

Installation

npm install computed-value-stream

Usage

var ComputedValueStream = require('computed-value-stream');

var cps = new ComputedValueStream();

console.log(cps.value);
// -> undefined

cps.write({my: 'object'});
console.log(cps.value);
// -> { my: 'object' }

cps.on('update', function(updatedValue) {
  console.log('update:', updatedValue);
});

cps.write({another: 'thing'});
// -> update: { another : 'thing' }