Lazy loading with fat client

You might start cracking your head when building fat client application and it take you few minutes to finish loading files before you can see the page with some dom elements. There won’t be any more of that kind problem Lazy loading and dynamically loading file, I just read my co-workers’ blog with combination of lazy loading, now we can build our fat client application without concerning any more about the size it takes to loading. to see how can you build fat client and loading it efficiently, YUI is a good example. YUI itself build up with almost 40 mb, to loading it all at load time you can’t really imagine how long it take, especially with the slow internet connection, to solve this, YUI is consists of my sub independent component, which mean you can loading the file piece by piece and it still working with not mush dependencies to one another. but that alone won’t just help, we gotta find a smart way to loading the component only when we demand it. thus lazy loading and dynamically loading file will come in place.

//Proxy object, which act as a ghost, it has reference to the real object
//When needed the real object is instantiated inside proxy
Proxy.ProxyImage = function(name){
	this.fileName = name;

	this.displayImage = function(){
		if(this.image == null) {
                    //Laod the javascript file on the fly
                    var jScript = document.createElement("script");
                    jScript.src = "RealImange.js";
                    jScript.type = "text/javascript";
                    this.image = new Proxy.RealImage(this.fileName); //load only on demand


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s