ember-alias-cps

0.1.1 • Public • Published

ember-alias-cps

The alias, readOnly and oneWay macros from @ember/object/comptued look like computed properties, but are actually alias properties.

The difference in semantics is that alias properties are always volatile which means

  • they're not cached and
  • they are sometimes recomputed eagerly
  • they are eagerly set up and don't have to be requested before observers will fire

Alias properties are eagerly evaluated during chain invalidation. For an example of this, see tests/dummy/app/components/foo-widget and note that bookThing and altBookThing will be recomputed at different times, the former eagerly and the latter only during rendering.

If you rely on observers firing on alias properties without them being requested, you will want alias semantics. Otherwise you will likely prefer CP semantics.

Compatibility

  • Ember.js v2.18 or above
  • Ember CLI v2.13 or above

Installation

ember install ember-alias-cps

Usage

import { alias, readOnly, oneWay } from 'ember-alias-cps';

// these macros work the same as their equivalents from
// '@ember/object/computed' except that they're CPs and have CP semantics rather
// than alias semantics

License

This project is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i ember-alias-cps

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

7.77 kB

Total Files

13

Last publish

Collaborators

  • hjdivad