@ember-decorators/auto-computed

2.0.0 • Public • Published

@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 repository
  • cd @ember-decorators/auto-computed
  • yarn install

Running

Running Tests

  • yarn test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

Package Sidebar

Install

npm i @ember-decorators/auto-computed

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

231 kB

Total Files

8

Last publish

Collaborators

  • pzuraq
  • rwjblue