2.0.0 • Published 8 years ago
@ember-decorators/auto-computed v2.0.0
@ember-decorators/auto-computed
Note: If you are using getter and setter functions (the recommended way), please use the @computed key from ember-decorators
Installation
ember install @ember-decorators/auto-computed
If you're using @ember-decorators/auto-computed in an addon, pass the -S option to save
this as a dependency as opposed to the default devDependency:
ember install -S @ember-decorators/auto-computed
Application Usage
In your application where you would normally have:
import Ember from 'ember';
export default Ember.Component.extend({
bar: Ember.computed('someKey', 'otherKey', function() {
var someKey = this.get('someKey');
var otherKey = this.get('otherKey');
return `${someKey} - ${otherKey}`;
})
})You replace it with this:
import Component from '@ember/component';
import autoComputed from '@ember-decorators/auto-computed';
export default class ExampleComponent extends Component {
@autoComputed('someKey', 'otherKey')
bar(someKey, otherKey) {
return `${someKey} - ${otherKey}`;
}
}Note: The @autoComputed decorator wraps ember-macro-helpers
which provides a lot of helpful features on top of standard computeds. It is
highly recommended that you read the documentation for that addon as well.
Installation
git clone <repository-url>this repositorycd @ember-decorators/auto-computedyarn install
Running
ember serve- Visit your app at http://localhost:4200.
Running Tests
yarn test(Runsember try:eachto test your addon against multiple Ember versions)ember testember test --server
Building
ember build
For more information on using ember-cli, visit https://ember-cli.com/.