Skip to content

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

Open
cjblomqvist wants to merge 1 commit into
derbyjs:masterfrom
cjblomqvist:subcomponents
Open

Add support for namespacing and subcomponents through prototype in compo...#485
cjblomqvist wants to merge 1 commit into
derbyjs:masterfrom
cjblomqvist:subcomponents

Conversation

@cjblomqvist

Copy link
Copy Markdown

...nents load

@cjblomqvist

Copy link
Copy Markdown
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