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

"Mixed in" callback for mixins #1138

Closed
andreypopp opened this issue Feb 20, 2014 · 3 comments
Closed

"Mixed in" callback for mixins #1138

andreypopp opened this issue Feb 20, 2014 · 3 comments

Comments

@andreypopp
Copy link
Contributor

What do you think of a "mixed in" callback for mixins which is called at the moment of applying a mixin to a component with component's spec as an argument?

var SomeTrickeryMixin = {
  mixin: function(spec) {
    // redefine .render() or do some other dangerous things
  },

  ...
};

Besides overriding .render() such callbacks can be used when you want to implement a "custom policy" for some methods (wrap method, call-before, call-after, ...).

As a downside that would make things a little less straightforward from a (mixin) user perspective.

@syranide
Copy link
Contributor

Magically overriding render seems like a bad idea, it seems to me like it would be better for the Mixin to explicitly state that it implements the render method and that you should instead implement renderBecauseOfMixin. Also, I'm assuming it wouldn't fly with ES6-classes when they come around?

@andreypopp
Copy link
Contributor Author

Another use case is to implement custom overriding policies for some methods, like now we have DEFINE_ONCE and so on...

@jimfb
Copy link
Contributor

jimfb commented Feb 10, 2016

As per #1305 (comment), mixins are a legacy feature and we're not really adding things to them at this point. This issue has been untouched for over a year, closing due to inactivity.

@jimfb jimfb closed this as completed Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants