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

Feature Request: Allow composition of computed decorators #99

Closed
mwpastore opened this issue Jun 18, 2017 · 2 comments
Closed

Feature Request: Allow composition of computed decorators #99

mwpastore opened this issue Jun 18, 2017 · 2 comments

Comments

@mwpastore
Copy link

mwpastore commented Jun 18, 2017

For feature parity with ember-macro-helpers and ember-awesome-macros.

This works:

import EmberObject from 'ember-object';

import or from 'ember-awesome-macros/or';
import computed from 'ember-macro-helpers/computed';

export default EmberObject.extend({
  foo: computed(or('bar', 'qux'), function(barOrQux) {
  })
});

This, sadly, does not:

import EmberObject from 'ember-object';

import computed, { or } from 'ember-computed-decorators';

export default EmberObject.extend({
  @computed @or('bar', 'qux') // or @computed(or(..))
  foo(barOrQux) {
  }
});

This works (with kellyselden/ember-awesome-macros#348):

import EmberObject from 'ember-object';

import mapBy from 'ember-awesome-macros/array/map-by';
import sum from 'ember-awesome-macros/sum';
import raw from 'ember-macro-helpers/raw';

export default EmberObject.extend({
  items: [],
  
  totalQuantity: sum(mapBy('items', raw('quantity')))
});

This, sadly, does not:

import EmberObject from 'ember-object';

import { mapBy, sum } from 'ember-computed-decorators';

export default EmberObject.extend({
  items: [],

  @sum @mapBy('items', 'quantity') // or @sum(mapBy(..))
  totalQuantity
});
@rwjblue
Copy link
Contributor

rwjblue commented Jun 21, 2017

Thank you for opening the issue with detailed examples! I think that we can make this work...

@pzuraq
Copy link
Contributor

pzuraq commented Feb 23, 2018

Reopened on the auto-computed decorator repo: ember-decorators/auto-computed#4

@pzuraq pzuraq closed this as completed Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants