Skip to content

Commit

Permalink
Merge pull request #5 from workmanw/gj/readme
Browse files Browse the repository at this point in the history
readme
  • Loading branch information
GavinJoyce committed Oct 31, 2017
2 parents 91ac2a6 + 1c92016 commit 656c3e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,28 @@
This addon is a WIP rethink of [ember-diff-attrs](https://github.com/workmanw/ember-diff-attrs) which offered a decorator style approach to this problem.

With `ember-did-change-attrs` we're going to solve the same problem using mixins instead of decorators. The hope is to offer a cleaner and more clear syntax without sacrificing functionality.


## Installation

`ember install ember-did-change-attrs`

## Usage

```js
import DidChangeAttrs from 'ember-did-change-attrs';

export default Ember.Component.extend(DidChangeAttrs, {
didChangeAttrsConfig: {
attrs: ['email', 'isAdmin']
},

didChangeAttrs(changes) {
if(changes.email) {
let oldEmail = changes.email.previous,
newEmail = changes.email.current;
// Do stuff
}
}
});
```

0 comments on commit 656c3e0

Please sign in to comment.