Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement this! #1

Closed
workmanw opened this issue Oct 31, 2017 · 2 comments · Fixed by #2
Closed

Implement this! #1

workmanw opened this issue Oct 31, 2017 · 2 comments · Fixed by #2
Assignees

Comments

@workmanw
Copy link
Owner

workmanw commented Oct 31, 2017

Originally started: workmanw/ember-diff-attrs#4 .

Rough out of the API provided by @GavinJoyce :

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
    }
  }
});
@GavinJoyce GavinJoyce self-assigned this Oct 31, 2017
@workmanw
Copy link
Owner Author

workmanw commented Oct 31, 2017

The biggest concern I had about this API when I looked at it was regarding inheritance. What would happen if someone wanted to extend a component that was using DidChangeAttrs and use it themself? Specifically around the didChangeAttrsConfig.

We could:

  1. Say sorry, it's not supported
  2. Make it a concatenatedProperties and/or mergedProperties
  3. ???

@GavinJoyce
Copy link
Collaborator

If it's going to be a hash, mergedProperties seems like a fine solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants