Very cool, thanks.

On Monday, March 11, 2013 10:20:20 PM UTC-5, Raynos wrote:
>
> observable and it's `compute` function ( 
> https://github.com/dominictarr/observable#compute ) can do the same
>
> ```js
> var o = require('observable')
>
> var first = o()
> var last = o()
> var fullName = o.compute([first, last], function (f, l) { return f + " " + 
> l })
>
> fullName(function onChange(fullName) {
>   /* do stuff */
> })
> ```
>
> @Rick the reason to use an observable abstraction is to listen to change 
> notifications. i.e. the observable / computable abstraction should be push 
> based, meaning that when a property changes all computed properties and 
> their listeners are notified of the change.
>
> You could use `Object.observe` but that requires observing mutable objects 
> where as `observable` can work in an immutable / read-only / reactive 
> fashion
>
>
> On Mon, Mar 11, 2013 at 2:59 PM, Tristan Slominski 
> <[email protected]<javascript:>
> > wrote:
>
>> lol... I think you're mostly right. That's what happens if I'm looking at 
>> it from only one perspective.
>>
>> I guess a difference is a minor one, and that would be with the ability 
>> to listen to the "update" event:
>>
>> full.on('update', function(updatedValue) {
>>   console.log('update:', updatedValue);
>> });
>>
>> That seems to be outside of the object meta API yes? (although your point 
>> is well taken, and computed-value doesn't seem like much of an 
>> improvement over it).
>>
>> Thanks for pointing it out, I need to think some more about it.
>>
>>
>> On Monday, March 11, 2013 4:00:13 PM UTC-5, Rick Waldron wrote:
>>>
>>> I haven't seen anything so far that couldn't be done with the object 
>>> meta API...
>>>
>>> var fname = "John", lname = "Doe";
>>>
>>> Object.defineProperty(this, "full", {
>>>   get: function() {
>>>     return fname + " " + lname;
>>>   }
>>> });
>>>
>>> full;
>>> // "John Doe"
>>>     
>>>
>>> On Monday, March 11, 2013, Tristan Slominski wrote:
>>>
>>>> Thanks Andrey, those are great pointers, I'll take a look.
>>>>
>>>> On Monday, March 11, 2013 2:08:09 PM UTC-5, Андрей Листочкин wrote:
>>>>>
>>>>> Another similar project: 
>>>>> http://component.io/**w**eepy/attr<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/**docum**
>>>>> entation/**computedObservables.**html<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/**trist**
>>>>> anls/node-computed-value<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<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
>>>>> nodejs+un...@**googlegroups.com
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group**/nodejs?hl=en?hl=en<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 nodejs+un...@**googlegroups.com.
>>>>> For more options, visit 
>>>>> https://groups.google.com/**grou**ps/opt_out<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<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
>>>> nodejs+unsubscribe@**googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<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 nodejs+unsubscribe@**googlegroups.com.
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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] <javascript:>.
>> 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