-
Notifications
You must be signed in to change notification settings - Fork 12
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Thoughts on Store mixins #4
Comments
Hi Leland, thanks for your interest. _mixin is intended to be private. If we want to provide a public API for adding mixins, then we should change the naming some how, because stores have "mixin" method for creating a ReactComponent Mixin. |
@kjda right. I knew the How do you feel about my proposal above? This would make it so that mixins could only be defined when defining the store itself using the This would only require a special handling of any array-like var FooMixin = {
bar: function () { ... }
};
var EnhancedFooMixin = {
mixins: [FooMixin],
doMore: function () { ... this.bar(); ... }
};
Flux.createStore({
mixins: [EnhancedFooMixin],
...
},[
...
]); What do you think? |
sounds great! recursive is also a good idea! Let me know if you want to do it.. if not, I can do it when I have some time. |
I'd be happy to do it. Let me see what I can do tonight and I'll submit a PR Thanks. |
First, I'd like to say thanks for creating ReactFlux. I did a lot of looking around at Flux libraries to reduce some of the boilerplate, and I landed on ReactFlux as I think the general style agrees with me the most!
As I've been playing around with it, I've been creating some mixins for my Stores. Initially, I was doing it this way:
Then, after looking at the source, I found I was able to do this instead:
Although, based on the method naming, it seems like this is using what is intended to be a private method.
Since Flux is likely to be used with React, the style I'm really looking for would be something like:
Is this syntax that you'd be open to? If so, I may submit it as a pull request.
Let me know, thanks!
The text was updated successfully, but these errors were encountered: