computed-value

Computed values in reactive style of programming

computed-value

Stability: 1 - Experimental

Stability as defined by Node.js

A module for creating computed value in reactive programming style.

npm install computed-value

Below example can be also found in examples/fullname.js.

var computedValue = require('computed-value');
 
var first = computedValue('Tom');
var last = computedValue('Dale');
var fullName = computedValue(first, last, function(firstlast) {
  return first + ' ' + last;
});
 
console.log(fullName.value);
 
first.write('Bob');
console.log(fullName.value);
 
fullName.on('update', function(updatedValue) {
  console.log('update:', updatedValue);
});
 
lastName.write('Johnson');

The output of running the above script will be:

Tom Dale
Bob Dale
update: Bob Johnson