-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support to add additional methods to exclude #3
Comments
I totally agree. I'm open to either approach, alhough I like the second one better since it's less global. PR would be welcome. |
@sstur Could be good to support both, although I think it might be better to support the global one if you're going to choose just one. Our site uses React + Meteor so the React Meteor Data mixin method appears a lot and the per-usage pattern would result in a lot of boilerplate. I would assume many people's projects would be like this, having a handful of mixin methods that appear throughout the codebase. |
I'm down with that. |
I suggest to add 'private method prefix' property |
I'd prefer to use the more-general class-autobind instead of the more-specific react-autobind, but I don't think I can until a way to exclude or blacklist functions is provided. Here's how they did it, although I think that |
Some packages provide mixins (which I know are frowned upon but still unavoidable in certain cases) or subclasses of
React.Component
that create additional component lifecycle methods. It would be good to allow the addition of other method names to be excluded in the binding to avoid possible weird behavior. Some example libraries I know of (because we use them):routerWillLeave
). Subsequent versions have changed the pattern).getMeteorData
) to fetch data from a Meteor backend.Maybe something like:
autobind.excludeAdditional(['method1', 'method2', ...]) // globally add to REACT_EXCLUDE_METHODS
or
autobind(this, otherProto, { exclude: ['method1', 'method2', ...] }) // for one-off instances
The text was updated successfully, but these errors were encountered: