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

Add support for namespacing and subcomponents through prototype in compo... #485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cjblomqvist
Copy link

...nents load

@cjblomqvist
Copy link
Author

Adds the possibility to add a subcomponents on your Component prototype - i.e. without access to app. E.g.

// When this component is loaded through app.component('./mycomponent/index.js'), the subcomponent will automatically be loaded namespaced to the maincomponents name (and possible namespace), i.e. you will have two components loaded (from below component):
// maincomponent
// maincomponent:subcomponent
function MyComponent () {}

MyComponent.prototype.name = 'maincomponent'
MyComponent.prototype.components = [require('subcomponent')]

Also adds automatic namespacing when loading components. Basically, this facilitates loading subcomponents without access to app, which furthermore makes it possible to allow for better separation of concerns and encapsulation when having a hierarchy of components.

PS. This is just a first step towards some simple use cases and can most definitely be built out further to better support all kinds of cases and situations.

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 this pull request may close these issues.

1 participant