split from #4
IMO, there are a couple issues with components.
-
render is called as both a pseudo-constructor to inject params into the component's closure as well as a refresh re-renderer.
-
Components are not instanced, so no reference to them exists, this prevents exposure of any public api. eg not possible:
return {
render: render,
someAPIMethod: foo,
somePublicProp: bar,
}
-
Pre-instantiated components cannot be provided into a tree.
-
The top-level .update() method acts as a constructor for the entire component tree and must accept params for all its sub-components.
For 1, maybe expose a render: and separate init:.
For 2, creating instances will allow for an API to be exposed for each component.
For 3, components can be externally created using their own inits and inserted into their parents via the parent's init (dep injection).
For 4, should be a non-issue if the others are implemented.
I don't know how much of this is do-able and would bloat/complicate the framework, so consider these wishes :)
split from #4
IMO, there are a couple issues with components.
renderis called as both a pseudo-constructor to inject params into the component's closure as well as a refresh re-renderer.Components are not instanced, so no reference to them exists, this prevents exposure of any public api. eg not possible:
Pre-instantiated components cannot be provided into a tree.
The top-level
.update()method acts as a constructor for the entire component tree and must accept params for all its sub-components.For 1, maybe expose a
render:and separateinit:.For 2, creating instances will allow for an API to be exposed for each component.
For 3, components can be externally created using their own
inits and inserted into their parents via the parent'sinit(dep injection).For 4, should be a non-issue if the others are implemented.
I don't know how much of this is do-able and would bloat/complicate the framework, so consider these wishes :)