-
Notifications
You must be signed in to change notification settings - Fork 6
2 Render
Alex Kit edited this page Mar 29, 2015
·
1 revision
To completely understand how components work, it is very importent to understand the render flow, at least the basics. And they are extemely simple.
Mask or Html templates are parsed to Mask AST. Essential nodes and their properties are:
-
Node
tagName: String
attr: Object
nodes: Array
parent: Node
-
TextNode
content: String|Function
parent: Node
-
StatementNode
tagName: String
attr: Object
expression: String
nodes: Array
parent: Node
Each render iteration is visiting a node and running appropriate Builder on it. Builder excepts model, context, element and current controller.
📍 If
render
function is not overriden, then builder creates a component in 2 stages:
-
renderStart
: here the component can redefine its model object, its nodes, etc - Builder creates all the subnodes
-
renderEnd
: here the component is already rendered and gets its elements
This note is especially interesting for the NodeJS rendering: while
start
is called on the backend, and theend
occures on the frontend.
🏁