October 2006
Intermediate to advanced
288 pages
5h 55m
English
Creating a JavaScript object with the Singleton pattern is so simple and intuitive that you might not have even realized that you made one in Chapter 6, “Creating the Engine,” when you created the Ajax object. To instantiate a Singleton object, simply write the following line of code:
AjaxUpdater = {};Instantiating the object is truly this simple and, as you can see, it only allows us to create the one reference to the object within the object itself. This object will then be used throughout the rest of the web application for constant reference. Now that we have our object instantiated, all we have to do is call it by name from anywhere in the application to access its properties and methods.
Read now
Unlock full access