This is the core module of the page framework. It is required for all the other page framework modules.
===== Initialization =====
The purpose of this module is to ensure all sub-modules are initialized, including a call to a possible implementer-provided ''$p.**init**()'' method. In order to do this, it uses the [[toolbox:event:onready:index|.onReady]] event method to call pre-init functions in each module. After this, it checks if ''$p.**init**()'' exists, and calls it if it does.
==== Pre-init ====
Pre-init methods should be provided by the developer of sub-modules. these are simply function definitions named ''_init'' in the root of each module – for example: ''$p.gui._init()''.
The way that the call to these sub-items’ ''_init()'' methods is implemented, it binds ''this'' object to the object they belong to. This allows the developer to simply refer to object members using ''this'' (e.g. ''this.myFunction()'', etc.).
==== Global init ====
The global //init// method is called after the pre-initialisation phase is finished. This function can be implemented as follows:
>
$p.init = function() {
…
}
Note:
Both, the //pre-init// and the //global init// functions are called without parameters. Some modules may however require a secondary init, for which the implementer has to provide parameters. Please read the manuals for the used modules for more information.
===== See also =====
* [[toolbox:event:onready:index|.onReady]]
===== More information =====
* [[mdn>Web/API/Document/readyState|Document: readyState property]] on MDN.