...
Wiki Markup |
---|
\[1] The new style visitor no longer returns a value, instead the value can be returned using visit.stop(value) \[2] The new visit object is introduced to control the visitor traversal \[3] Instead of relying on magic return values the traversal is stopped by using the new visit object \[4] Same as \[3] but a different method on IVisit is used |
Component Initialization - Component#onInitialize
A new callback method was added to Component class - onInitialize(). This method is intended to provide an alternate place to initialize the component in addition to standard constructors. The advantage of using this method over a constructor is that when it is invoked the Page and the markup of the component are both available and so a more complex initialization can take place.
Before this method was introduced the developer had to rely on using onBeforeRender() method with some kind of "has-already-been-called-or-not" check to make sure the initialization code has only been run a single time. onInitialize() has this guarantee baked in - it will only be called once during the lifetime of the component.