PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Eight Weeks of Prototype: Week 8, A Complete Prototype Example

Starting the JavaScript Application

The next step is to implement the Application.js file, used to bootstrap the application. That is, it is responsible for instantiating the contact manager JavaScript classes. The technique used here of creating an object in which to hold useful application functions is shoed in the previous article in this series.

Listing 9 shows the code for Application.js, which I assume you store in the /js directory on your web server.

Listing 9 The application JavaScript bootstrap file (Application.js)
var Application = {
 
    startup : function()
    {
        new AddressBook_Creator('creator');
        new AddressBook_Contacts('contacts');
    }
};
 
Event.observe(window, 'load', Application.startup);

Note that if you load the index.html file (from Listing 8) in your web browser now an error will occur since the AddressBook_Creator and AddressBook_Contacts classes have not yet been defined.

In This Article