I saw a presentation, recently, on Ember.js computed properties. This got
me curious about reactive programming.
computed-value is a tiny library that allows developers to very simply
specify dependencies between properties and recalculate them every time one
of those dependent properties changes. This isn't a new idea, but I've
attempted to make it as small and as powerful as possible. (And in the
spirit of "stream all the things", I attempted to use the new "streams2"
under the hood, so it requires node >= 0.9.12).
If you're interested in reactive programming I would love some feedback on
the API. It's still brand new, and experimental.
Here's a computed full name example:
var cv = require('computed-value');
var first = cv('John');
var last = cv('Smith');
var full = cv(first, last, function(first, last) {
return first + ' ' + last;
});
console.log(full.value);
first.write('Bob');
console.log(full.value);
full.on('update', function(updatedValue) {
console.log('update:', updatedValue);
});
last.write('Johnson');
You can find the project here:
https://github.com/tristanls/node-computed-value
Cheers,
Tristan
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.