Another similar project: http://component.io/weepy/attr

It's a component, not the npm package but it's pretty easy to add it to your 
project since it's only one file.

The API is similar to Knockout js 
http://knockoutjs.com/documentation/computedObservables.html

var firstName = attr('John'), lastName = attr('Dow'), fullName = attr(function 
() {
    return firstName() + ' ' + lastName()
})

lastName('Resig')

fullName() // === 'John Resig'

It does the same thing as your package but does automatic dependency resolution 
and tracking. Take a look!

BTW that's one of the reasons why I prefer something like Knockout or Angular 
to Ember.

Andrey

On Mar 11, 2013, at 02:22 , Tristan Slominski wrote:

> 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.
>  
>  

-- 
-- 
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.


Reply via email to