# ember-computed-indirect

> A small addon to help declare dynamic (or indirect) computed properties.

Latest version **1.0.0** (published 2017-05-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-computed-indirect
pnpm add ember-computed-indirect
yarn add ember-computed-indirect
bun add ember-computed-indirect
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-15 |
| First published | 2015-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | gordonkristan |
| Keywords | ember-addon |

## Links

- npm: https://www.npmjs.com/package/ember-computed-indirect
- Repository: https://github.com/gordonkristan/ember-computed-indirect
- Homepage: https://github.com/gordonkristan/ember-computed-indirect#readme
- Issues: https://github.com/gordonkristan/ember-computed-indirect/issues
- npm.io page: https://npm.io/package/ember-computed-indirect

## Dependencies (1)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^6.0.0

## Recent versions

- 1.0.0 (latest) — 2017-05-15
- 0.3.1 — 2017-05-11
- 0.3.0 — 2015-10-24
- 0.2.0 — 2015-03-22
- 0.1.0 — 2015-03-21

## README

# ember-computed-indirect

This is a small Ember addon that helps deal with indirect or dynamic computed properties. What this means
is that you can have one property store a reference to the property you would really like to watch,
getting updates when either the referenced property or the reference changes. Example:
 
```js
import computedIndirect from 'ember-computed-indirect';

var object = Ember.Object.extend({
  source1: 'value1',
  source2: 'value2',
  path: 'source1',
  value: computedIndirect('path')
}).create();

object.get('value'); // 'value1'
object.set('value', 'newvalue');
object.get('source1'); // 'newvalue'
object.set('path', 'source2');
object.get('value'); // 'value2'
```

There also is nothing stoping you from making the `path` itself a computed property:

```js
var object = Ember.Object.extend({
  originalObject: { original: true },
  editingObject: { editing: true },

  editing: false,
  objectPath: Ember.computed('editing', function() {
    return this.get('editing') ? 'editingObject' : 'originalObject'
  },
  
  currentObject: computedIndirect('objectPath')
}).create();

object.get('currentObject'); // { original: true }
object.toggleProperty('editing');
object.get('currentObject'); // { editing: true }
```

---
_Source: https://npm.io/package/ember-computed-indirect · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
