Lazy loading javascript and css

This method will allow one to call ResourceLoader.load() when you want to start loading an array of javascript and/or css resource files into the current page. The success callback method will be called as soon as everything is loaded. Since it waits 50 milliseconds between checks (if everything is loaded), it will not “lock up” the page.

Update: Improved version – Can dynamically load jquery now and tests if library is loaded before adding it

To use this one can call ResourceLoader.load() as follows:

Posted in Blog, Develop
Tweets