computed-value-stream

0.1.0 • Public • Published

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' }

Readme

Keywords

none

Package Sidebar

Install

npm i computed-value-stream

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • tristanls