How Components Gets Initialized
The initialization of a component always follows the same scheme:
- A component factory method will be called with an start definition object:
1 2 3 4 5
- The component factory create a generic or specific instance of the component class with the environment object:
1 2 3 4 5 6 7 8 9 10 11
The prepare method receives this object and after some basic checks, the super prepare method will be called with the same environment object. The super prepare method:
Saves the environment object.
- Initialize the event methods.
- Merge the settings and options from
startobject with default values.
- Binds callbacks defined in
- Prepare the
The super prepare method use the following properties:
1 2 3 4 5 6 7 8 9 10 11 12 13
- Then the prepare method of the component prepares
scrollelements. From here it is important to use "this.id" (or "this.env.init.id") instead of "this.env.start.id" and "this.init.type" instead "env.start.type". The method complements the environment object with the final element pointers:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Block or Splash will be started. After this point individual steps will be carried out.
After the prepare method the user defined init method will be called and then the finalize method. If needed inside the finalize method sometimes
await bootwill be called. This call should be done as last one. if only
startdefined then this is the last call, if
bootthe last call. After that only unblock the component (or close splash).
System class do not have a component factory method. Step 1 and 2 will be processed inside of
The steps in a component factory in detail:
idis used already. Widgets and Stages will throw an error. Application will return the running instance with this id.
The start definition object will be cloned to the init definition object. This is supplemented with additional or default values:
Set a random id if not set.
Set a default type (in Widget and Stage)
Prepare values for the environment object:
containeris valid. The
containerwill be specified here or in the override methods of the facytory methods. System do not execute this step, because System do not have a container.
Create generic or specific instance of the component class with the environment object.
Wait for initialization
Add instance to the internal registry.