Chapter 11. Creating Custom JavaScript Objects
JavaScript is a wonderfully chaotic language. Some would say this is a good thing; others would say it’s the biggest detriment to its use—so much so that there’s a move to a new version of JavaScript, JavaScript 2.0, in order to tighten up some of the language’s looser aspects. Proponents of a newer version say it’s important to do so if JavaScript is to scale and be able to meet increasing demands.
After working with the previous examples, you might be scratching your head over the concept of JavaScript scaling. After all, the script tag is one of the most common found in web pages, and most sites use some form of JS. Any site that offers a shopping cart or other interactive element most likely uses JavaScript. Considering all of this, what could possibly be driving the concern about JavaScript and scaling?
The answer to that question—creating libraries of custom objects—is the core of this chapter. The new interest in Ajax and a renewed interest in Dynamic HTML has led to a growing number of fairly large JS libraries and even larger web-based applications, so it appears that scaling really has become an issue of concern.
Or does it? After all, most of us aren’t going to be creating Ajax-based replacements for Microsoft Word or Adobe Photoshop. Most of what we need are smaller libraries of objects that manage some of the more esoteric elements of Ajaxian server-side access or DHTML’s more complex effects.
It is an ongoing debate, and one ...
Get Learning JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.