-
Notifications
You must be signed in to change notification settings - Fork 2
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
Define which (if any) properties should be exported on mixins #7
Comments
Yes you are right. However, these properties are clearly documented. To me, they are part of the contract of
Yes. And there is a bit more to it:
In fact, Do you have any ideas on how to improve it? Edit: one simple idea could be to move the var Looker = mix(..)
typeof Looker // 'function'
typeof Looker.mixin // 'function'
typeof Looker.mixin.class // 'function'
typeof Looker.mixin.interface // 'object' This wouldn't completely fix the issue but it would make it smaller. |
I just opened the issue since I think the solution can be improved, but I do not see any immediate way, other than using Symbols. Even though support is bad, it might already work with Babel in older browsers. Well, for now, I am doing refactoring, so I leave that here for later. |
I think we should try to decide on this before 1.0 as it's a part of the Public API right now. |
Turning these into something a bit more obscurely named would definitely help. I agree with stubbing, but perhaps stick them all inside a var Looker = mix(..)
typeof Looker // 'function'
typeof Looker._mics // 'object'
typeof Looker._mics.mixin // 'function'
typeof Looker._mics.class // 'function'
typeof Looker._mics.interface // 'object' |
This code exposes certain properties on the returned constructor. If a user tries to place their own static property in a class with one of those property names, it will be overwritten. In order to counter that problem, Symbols should be used. However, IE11 does not support Symbols and Babel has problems dealing with them.
The text was updated successfully, but these errors were encountered: