Download

Concepts

Example

Documentation

Plugins

How to

Contribute

Links

Initializer

What is this ?

This is the class that is used by you to launch the initialization of the framework.

How to launch the initialization of my application ?

It is really simple. Once you included prototype, the extends js file and the framework itself. Create a new instance of the Initializer. Then call the init method on it passing as the first argument the URL of the framework configuration file. An example is below :

<head>
	...
	<script type="text/javascript" src="http://localhost/js/WZFwk/libs/prototype/1.6.0.3.js"></script>
	<script type="text/javascript" src="http://localhost/js/WZFwk/libs/prototype/extends.js"></script>
	<script type="text/javascript" src="http://localhost/js/WZFwk/compress/compress.js"></script>
	<script type="text/javascript">
		var initializer = new Initializer();
		initializer.init("http://localhost/js/application/conf.xml");
	</script>
	...
</head>

Sometimes, you will use the same framework configuration file for multiple application. You can add two other arguments to the init method. Both are object. The first one is the equivalent of what is in the framework part of the framework configuration file. The second one is the equivalent of what is in the application part of the framework configuration file. Multiple example are below :

initializer.init("http://localhost/js/application/conf.xml", {
		mvcFile: "http://localhost/js/application/mvc.xml",
		baseUrl: "http://localhost/js/"					
		});

initializer.init("http://localhost/js/application/conf.xml", {
		mvcFile: "http://localhost/js/application/mvc.xml",
		baseUrl: "http://localhost/js/"					
		}, {
		myApplicationData: 42,
		myApplicationUrl: "js/ajax/proxie.php"
		});

Initializer method

init(urlToFwkConfFile, fwkData, appData)

Method you will call to initialize the framework.

If you pass object for fwkData and/or appData, it will override the value in the framework configuration file.