Toolkit size and dynamic loading

Let's have a quick look at OAT's size. The core set of JS files (excluding documentation, images, styles and bundled applications) has over 1.6MBytes (89 files total with build 20070406). Now that is some amount of data, I can almost hear people whispering "I am not going to include such big framework into my tiny application; my users are not sitting at 10+Mbit lines!" Well, this is completely misleading thinking, as you will soon see.

OAT uses dynamic loading of libraries. So, in real life, the only file you *have* to include is loader.js. This one contains basic shared code and supplemental routines. Its size is cca 30kbytes (compare with prototype.js, weighing over 70kbytes). You can then specify which features you would like to use; OAT will create a dependency chain and include all needed files. Watch:

<script type="text/javascript">
var featureList = ["grid","ajax2"];
</script>
<script type="text/javascript" src="oat/loader.js"></script>

This is a typical OAT setup. User wants to have Ajax functionality and Grid widget; the only manually included file is still loader.js.

Now you may be wondering "What if I decide to include additional features *after* the page was loaded?" No problem for OAT, as you can see:

var callback = function(){ alert("Pivot component is loaded and ready!"); }
OAT.Loader.loadFeatures("pivot",callback);