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.
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.





