Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computed values #1

Open
yckart opened this issue Jun 19, 2014 · 2 comments
Open

Computed values #1

yckart opened this issue Jun 19, 2014 · 2 comments

Comments

@yckart
Copy link

yckart commented Jun 19, 2014

It would great to make it possbible to get computed values. So, to make this work:

var firstName = prop('Foo');
var lastName = prop('Bar');
var fullName = prop(function () {
  return firstName() + ' ' + lastName();
});

fullName(); // => 'Foo Bar'
lastName('Raw');
fullName(); // => 'Foo Raw'
@azer
Copy link
Owner

azer commented Jun 19, 2014

how about

var firstName = prop('Foo');
var lastName = prop('Bar');

fullName()
// => Foo bar

function fullName () {
  return firstName() + lastName() 
}

@yckart
Copy link
Author

yckart commented Jun 19, 2014

Good thought, problem is that I've modified this component a bit. I've added an emitter to observe for value-changes (a similar way as you did with your attr-component).

Your solution above will work fine, if you use it as described in this issue, but yeah... It would make our life a bit "uncomfortable" if we want to keep an eye on changes ;)

@yckart yckart closed this as completed Jun 19, 2014
@yckart yckart reopened this Jun 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants