Skip to content
This repository was archived by the owner on Oct 29, 2019. It is now read-only.

Proposal: Lazy instantiation of components  #21

@akoenig

Description

@akoenig

It's more of a feature in the ComponentDomParser but I write it down here for the time when we transfer the projects over to the new GitHub organization.

We should find a way to lazy instantiate components when a specific condition is fulfilled. Therefore we can avoid the instantiation of sub-components within a parent component. So instead of doing this:

import {Component} from 'nodeproto';
import SubComponent from 'ma-subcomponent';

class ParentComponent extends Component {
     // yada yada yada yada

    anAction () {
        let subc = new SubComponent();
    }
}

we should find a way to do this in a declarative way, like:

import {Component} from 'nodeproto';

class ParentComponent extends Component {
    // yada yada yada yada

    anAction () {
        this.modalVisible = true;
    }
}
<div data-component="ParentComponent">
     <div data-component="SubComponent" data-component-when="ParentComponent.modalVisible">
        yip yip yip
     </div>
</div>

@Inkdpixels @grebaldi What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions