-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hi William,
The main difference would be that @init() requires a Binder or BinderComposer.
While they are both cheap, ${} is a tiny bit cheaper since there is no memory overhead. Unless you have extremely large amounts of Expressions in a context, the difference should not be noticeable.
As you mentioned, @init() happen during bind, which is after zul parsing. ${} are evaluated during parsing. Due to this, you can reference a component further down a zul page in @init, but not in ${}.
Otherwise, they provide the same function: one-time evaluation of an expression during page initialization, without maintaining a tracking entry afterward.
PS: that's a good addition to the do's and don't, so I will also reply there ;-) Regards, Matt
2 | No.2 Revision |
Hi William,
The main difference would be that @init() requires a Binder or BinderComposer.BindComposer.
While they are both cheap, ${} is a tiny bit cheaper since there is no memory overhead. Unless you have extremely large amounts of Expressions in a context, the difference should not be noticeable.
As you mentioned, @init() happen during bind, which is after zul parsing. ${} are evaluated during parsing. Due to this, you can reference a component further down a zul page in @init, but not in ${}.
Otherwise, they provide the same function: one-time evaluation of an expression during page initialization, without maintaining a tracking entry afterward.
PS: that's a good addition to the do's and don't, so I will also reply there ;-) Regards, Matt
Edit: corrected the obvious classname error BinderComposer > BindComposer