Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

mainmatter/ember-auto-computed

Repository files navigation

Build Status

ember-auto-computed

ember-auto-computed introduce a mechanism for computed properties to automatically track their dependent keys so they don't have to be defined upfront.

This is an experiment and not (at all!!!) ready for production use!!!

Example

The classic fullName example looks like this with ember-auto-computed:

  fullName: computed(function() {
    return `${this.get('firstName')} ${this.get('lastName')}`;
  })

This is fully functional and will be re-evaluated when either the firstName or lastName properties change!

A slightly more involved example illustrates the potential performance improvements that something like ember-auto-computed could result in:

myProp: computed(function() {
  if (this.get('a')) {
    return this.get('b');
  } else {
    return this.get('c');
  }
}),

As dependent keys are recorded when the computed property function is executed, this property will never depend on all of a, b, c at the same time but only on either a and b when a is truthy or c if a is falsy. That of course leads to less invalidations (there is no need to invalidate the property if b changes when a is falsy anyway).

License

ember-auto-computed is developed by and © simplabs GmbH and contributors. It is released under the MIT License.

ember-auto-computed is not an official part of Ember.js and is not maintained by the Ember.js Core Team.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published