When to use what
| What I want to do | What should I use |
|---|---|
I want to wrap a single node and manage its lifecycle |
|
| I want to coordinate subcomponents under a single root node |
|
| I want to find DOM nodes and wrap them in wraplets automatically | Helpers AbstractWraplet: AbstractDependentWraplet: |
| I want safe DOM event listener management |
|
| I want to inject an existing wraplet instance into a dependent wraplet |
|
AbstractWraplet vs AbstractDependentWraplet
Use AbstractWraplet when:
- you wrap a single DOM node,
- you don't need dependencies,
- you want to add a lifecycle to a single DOM node,
- you want to create a small component like: input, button or output.
Use AbstractDependentWraplet when:
- component has an internal structure,
- you need dependencies,
- you want to declaratively search for child elements,
- you want to automate children's lifecycle management.